diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..d09c52d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,42 @@ +name: Build + +on: + push: + branches: ['main'] + tags: ['v*.*.*'] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: samanhappy/mcphub + tags: | + type=raw,value=edge,enable=${{ github.ref == 'refs/heads/main' }} + type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/') }} + type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }} + - name: Build and Push Docker Image + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index 8e04396..0000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Docker Image CI - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Build and Push Docker Image - uses: docker/build-push-action@v3 - with: - push: true - tags: samanhappy/mcphub:latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..91c152b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,33 @@ +name: GitHub Release + +on: + push: + tags: ['v*.*.*'] + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Extract Release Notes + id: extract-release-notes + run: | + echo "RELEASE_NOTES<> $GITHUB_ENV + git log $(git describe --tags --abbrev=0 HEAD^1 2>/dev/null || echo HEAD^1)..HEAD --pretty=format:"- %s%n%b" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 + with: + name: Release ${{ github.ref_name }} + body: | + # MCPHub ${{ github.ref_name }} + + ${{ env.RELEASE_NOTES }} + + draft: false + prerelease: false + generate_release_notes: true