Merge pull request #115 from HyperbolicLabs/dev #196
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
| --- | |
| name: Docker Build and Push Epitome Image | |
| on: | |
| push: | |
| branches: | |
| - dev | |
| - main | |
| tags: | |
| - "v*.*" | |
| paths: | |
| - "epitome/**" | |
| - ".github/workflows/epitome.yml" | |
| env: | |
| BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| # # Number of commits to fetch. 0 indicates all history for all branches and tags. | |
| # # Default: 1 | |
| # fetch-depth: 1 | |
| # # Whether to checkout submodules: `true` to checkout submodules or `recursive` to | |
| # # recursively checkout submodules. | |
| # # | |
| # # When the `ssh-key` input is not provided, SSH URLs beginning with | |
| # # `git@github.com:` are converted to HTTPS. | |
| # # | |
| # # Default: false | |
| submodules: true | |
| # | |
| # # Known hosts in addition to the user and global host key database. The public SSH | |
| # # keys for a host may be obtained using the utility `ssh-keyscan`. For example, | |
| # # `ssh-keyscan github.com`. The public key for github.com is always implicitly | |
| # # added. | |
| # ssh-known-hosts: '' | |
| # | |
| # # The user to use when connecting to the remote SSH host. By default 'git' is | |
| # # used. | |
| # # Default: git | |
| # ssh-user: 'git' | |
| # | |
| # # Whether to download Git-LFS files | |
| # # Default: false | |
| # lfs: '' | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| ghcr.io/hyperboliclabs/hyper-dos/epitome | |
| # generate Docker tags based on the following events/attributes | |
| tags: | | |
| type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
| type=schedule | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| type=ref,event=tag | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=sha | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| # Setting up Docker Buildx with docker-container driver is required | |
| # at the moment to be able to use a subdirectory with Git context | |
| - name: Set up Docker Buildx | |
| # we don't need to run the usual 'checkout' action, buildx takes care of it. | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Github Container Registry | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v3 | |
| # https://github.com/marketplace/actions/docker-login | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| # TODO try cache: https://docs.docker.com/build/ci/github-actions/cache/ | |
| # TODO try reproducible builds: https://docs.docker.com/build/ci/github-actions/reproducible-builds/ | |
| build-args: version=$GH_TAG | |
| platforms: linux/amd64,linux/arm/v6,linux/arm64 | |
| # source: "{{defaultContext}}" # if you don't set this, it will clone and fail because it doesn't understand submodules | |
| # context: "{{defaultContext}}:epitome" | |
| context: ./epitome | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |