create and tag docker image to git.vdb.to on publish

This commit is contained in:
Michael Shaw 2022-10-31 15:52:29 -04:00
parent 306bbb73ca
commit e1f96c186b

View File

@ -4,22 +4,28 @@ on:
types: [published] types: [published]
jobs: jobs:
docker_publish: docker_publish:
name: Push Docker image to Github Hub name: Run docker build and publish
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Get the version - uses: actions/checkout@v2
id: vars - name: Run docker build
run: | run: docker build -t cerc-io/watcher-ts -f Dockerfile .
echo ::set-output name=sha::$(echo ${GITHUB_SHA:0:7}) - name: Get the version
echo ::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/}) id: vars
- name: Docker Login to Registry run: |
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u cerc-io --password-stdin echo ::set-output name=sha::$(echo ${GITHUB_SHA:0:7})
- name: Docker Pull echo ::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/})
run: docker pull ghcr.io/cerc-io/watcher-ts:${{steps.vars.outputs.sha}} - name: Tag docker image
- name: Tag docker image run: docker tag cerc-io/watcher-ts git.vdb.to/cerc-io/watcher-ts/watcher-ts:${{steps.vars.outputs.sha}}
run: docker tag ghcr.io/cerc-io/watcher-ts:${{steps.vars.outputs.sha}} ghcr.io/cerc-io/watcher-ts:${{steps.vars.outputs.tag}} - name: Tag docker image
- name: Docker Push to Github Hub run: docker tag git.vdb.to/cerc-io/watcher-ts/watcher-ts:${{steps.vars.outputs.sha}} git.vdb.to/cerc-io/watcher-ts/watcher-ts:${{steps.vars.outputs.tag}}
run: docker push ghcr.io/cerc-io/watcher-ts:${{steps.vars.outputs.tag}} - name: Docker Login
run: echo ${{ secrets.GITEA_TOKEN }} | docker login https://git.vdb.to -u cerccicd --password-stdin
- name: Docker Push
run: docker push git.vdb.to/cerc-io/watcher-ts/watcher-ts:${{steps.vars.outputs.sha}}
- name: Docker Push TAGGED
run: docker push git.vdb.to/cerc-io/watcher-ts/watcher-ts:${{steps.vars.outputs.tag}}
npm_publish: npm_publish:
runs-on: ubuntu-latest runs-on: ubuntu-latest