Update Docker repo to aaronskiba/roadmap #17
Workflow file for this run
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
| # This workflow uses actions that are not certified by GitHub. | |
| # They are provided by a third-party and are governed by | |
| # separate terms of service, privacy policy, and support | |
| # documentation. | |
| name: Publish Docker image | |
| on: | |
| push: | |
| tags: | |
| - '*-dev.*' | |
| release: | |
| # `published` type is triggered for both `latest` and `prerelease` releases | |
| types: [published] | |
| jobs: | |
| push_to_registry: | |
| name: Push Docker image to Docker Hub | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v3 | |
| # Buildx allows for advanced Docker build features like multi-platform builds and layer caching | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| # Extract metadata for app image | |
| - name: Extract metadata (tags) for Docker app Image | |
| id: meta_app | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: aaronskiba/roadmap | |
| flavor: | | |
| latest=false | |
| suffix=-app | |
| # Conditional tagging logic based on event type and git tag pattern: | |
| # - If this is a prerelease and the tag matches: portage-(<version>-rc.<n>) → tag as <version>-rc.<n>-app | |
| # - If this is a latest release and the tag matches: portage-(<version>) → tag as <version>-app | |
| # - If this is a push event and the tag matches: portage-(<version>-dev.<n>) → tag as <version>-dev.<n>-app | |
| tags: | | |
| ${{ github.event.release.prerelease && | |
| 'type=match,pattern=.+portage-(\d+\.\d+\.\d+-rc.\d+)$,group=1' || | |
| (github.event_name == 'release' && !github.event.release.prerelease && | |
| 'type=match,pattern=.+portage-(\d+\.\d+\.\d+)$,group=1') || | |
| (github.event_name == 'push' && | |
| 'type=match,pattern=.+portage-(\d+\.\d+\.\d+-dev.\d+),group=1') }} | |
| # Extract metadata for assets image | |
| - name: Extract metadata (tags) for Docker assets image | |
| id: meta_assets | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: aaronskiba/roadmap | |
| flavor: | | |
| latest=false | |
| suffix=-assets | |
| # conditional tagging logic based on event type and git tag pattern: | |
| # - If a prerelease and the tag matches: portage-(<version>-rc.<n>) → tag as <version>-rc.<n>-assets | |
| # - If latest release and the tag matches: portage-(<version>) → tag as <version>-assets | |
| # - If a push event and the tag matches: portage-(<version>-dev.<n>) → tag as <version>-dev.<n>-assets | |
| tags: | | |
| ${{ github.event.release.prerelease && | |
| 'type=match,pattern=.+portage-(\d+\.\d+\.\d+-rc.\d+)$,group=1' || | |
| (github.event_name == 'release' && !github.event.release.prerelease && | |
| 'type=match,pattern=.+portage-(\d+\.\d+\.\d+)$,group=1') || | |
| (github.event_name == 'push' && | |
| 'type=match,pattern=.+portage-(\d+\.\d+\.\d+-dev.\d+),group=1') }} | |
| - name: Build and push the app stage image | |
| uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | |
| with: | |
| context: . | |
| file: Dockerfile.production | |
| target: app | |
| push: true | |
| tags: | | |
| ${{ steps.meta_app.outputs.tags }} | |
| # Fetch existing build cache from Docker Hub, if available | |
| cache-from: type=registry,ref=aaronskiba/roadmap:build-cache-app | |
| # Push the updated build cache to Docker Hub | |
| cache-to: type=registry,ref=aaronskiba/roadmap:build-cache-app,mode=max | |
| - name: Build and push the assets stage image | |
| uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | |
| with: | |
| context: . | |
| file: Dockerfile.production | |
| target: assets | |
| push: true | |
| tags: | | |
| ${{ steps.meta_assets.outputs.tags }} | |
| # Fetch existing build cache from Docker Hub, if available | |
| # else, built `app` layer will be used as a fallback cache | |
| cache-from: type=registry,ref=aaronskiba/roadmap:build-cache-assets | |
| # Push the updated build cache to Docker Hub | |
| cache-to: type=registry,ref=aaronskiba/roadmap:build-cache-assets,mode=max |