diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 86b9ea6..fb6dbe5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,7 +29,6 @@ jobs: env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - lint: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 021d592..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: publish - -on: - release: - types: [published] - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Login to GHCR - run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin - - - name: Build Docker image - run: docker build -t ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }} . - - - name: Tag image as latest - run: docker tag ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }} ghcr.io/${{ github.repository }}:latest - - - name: Push versioned tag to GHCR - run: docker push ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }} - - - name: Push latest tag to GHCR - run: docker push ghcr.io/${{ github.repository }}:latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6d8be93..d37636a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,4 +13,26 @@ jobs: uses: actions/checkout@v4 - name: Create GitHub Release - uses: ncipollo/release-action@v1 \ No newline at end of file + uses: ncipollo/release-action@v1 + + publish: + requires: release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Login to GHCR + run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin + + - name: Build Docker image + run: docker build -t ghcr.io/${{ github.repository }}:${{ github.ref_name }} . + + - name: Tag image as latest + run: docker tag ghcr.io/${{ github.repository }}:${{ github.ref_name }} ghcr.io/${{ github.repository }}:latest + + - name: Push versioned tag to GHCR + run: docker push ghcr.io/${{ github.repository }}:${{ github.ref_name }} + + - name: Push latest tag to GHCR + run: docker push ghcr.io/${{ github.repository }}:latest