From b61c34941ea861ee1782dd0ce3306888f190a8ce Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Sat, 21 Jan 2023 14:04:03 +0100 Subject: [PATCH] GHA workflow to Docker ghcr.io --- .github/workflows/master-latest.yml | 56 +++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/master-latest.yml diff --git a/.github/workflows/master-latest.yml b/.github/workflows/master-latest.yml new file mode 100644 index 0000000..1bf8901 --- /dev/null +++ b/.github/workflows/master-latest.yml @@ -0,0 +1,56 @@ +name: master-latest + +on: + push: + branches: [ "master" ] + #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 + 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 +