fix: update artifact download step to use dawidd6/action-download-art… #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI - Build and Push Docker Image | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| env: | |
| IMAGE_NAME: ghcr.io/${{ github.repository }} | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Bump version and push tag | |
| uses: anothrNick/[email protected] | |
| id: tag_action | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| WITH_V: true | |
| DEFAULT_BUMP: patch | |
| - name: Set IMAGE_TAG | |
| run: echo "IMAGE_TAG=${{ steps.tag_action.outputs.new_tag }}" >> $GITHUB_ENV | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Build and Push Docker image | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: . | |
| build-args: | | |
| DIRECTUS_URL=${{secrets.DIRECTUS_URL}} | |
| push: true | |
| tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}, ${{ env.IMAGE_NAME }}:latest | |
| cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache | |
| cache-to: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache,mode=max | |
| - name: Create Artifact with Image Tag | |
| run: | | |
| echo ${{ env.IMAGE_TAG }} > image_tag.txt | |
| - name: Upload Image Tag Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: image-tag | |
| path: image_tag.txt |