From a04f870a22ed4310c5cbe65822eb8fa88da5e53e Mon Sep 17 00:00:00 2001 From: Petu Eusebiu Date: Thu, 16 Jun 2022 15:43:01 +0300 Subject: [PATCH] Periodically sync golang image from dockerhub to ghcr.io Signed-off-by: Petu Eusebiu --- .github/workflows/sync-golang-image.yaml | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/sync-golang-image.yaml diff --git a/.github/workflows/sync-golang-image.yaml b/.github/workflows/sync-golang-image.yaml new file mode 100644 index 00000000..7c625c04 --- /dev/null +++ b/.github/workflows/sync-golang-image.yaml @@ -0,0 +1,28 @@ +name: 'Sync golang image from docker to ghcr' +on: + schedule: + - cron: '30 1 * * *' + push: + branches: + - main + +env: + GOLANG_VERSION: 1.18 + +jobs: + sync-golang: + name: 'sync' + runs-on: ubuntu-latest + steps: + - name: Log in to GitHub Docker Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Tag and push golang to ghcr + run: | + docker pull golang:${{ env.GOLANG_VERSION }} + docker tag golang:${{ env.GOLANG_VERSION }} ghcr.io/${{ github.repository_owner }}/golang:${{ env.GOLANG_VERSION }} + docker push ghcr.io/${{ github.repository_owner }}/golang:${{ env.GOLANG_VERSION }}