Create test.yml #1
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: main-latest | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [ "main" ] | |
| #schedule: | |
| # - cron: '0 3 * * *' # Scheduled runs every day at 3am UTC | |
| jobs: | |
| docker: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v2 | |
| - name: Set up Docker Buildx | |
| id: buildx | |
| uses: docker/setup-buildx-action@v2 | |
| #- name: Log in to Docker Hub | |
| # uses: docker/login-action@v2 | |
| # with: | |
| # username: ${{ secrets.DOCKER_USERNAME }} | |
| # password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Docker Login to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} # github username or org | |
| password: ${{ secrets.GITHUB_TOKEN }} # github actions builtin token. repo has to have pkg access. | |
| - name: Build and push | |
| id: docker_build | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| pull: true # avoid bitrot with repeated cache hits | |
| push: true | |
| tags: ghcr.io/${{ github.repository_owner }}/ansi-hastebin:latest,ghcr.io/${{ github.repository_owner }}/ansi-hastebin:0.0.9 # @TODO: read from package.json | |
| labels: | | |
| org.opencontainers.image.title=ansi-hastebin | |
| org.opencontainers.image.description=${{ github.event.repository.description }} | |
| org.opencontainers.image.url=${{ github.event.repository.html_url }} | |
| org.opencontainers.image.source=${{ github.event.repository.clone_url }} | |
| org.opencontainers.image.revision=${{ github.sha }} | |
| org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }} | |
| cache-from: type=gha # all-automatic Github Actions caching | |
| cache-to: type=gha,mode=max |