This repository has been archived on 2025-07-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
circuitbodge/.github/workflows/docker.yml
2022-11-09 00:53:21 +00:00

36 lines
No EOL
940 B
YAML

name: Docker Image CI
on:
release:
types: [published]
env:
IMAGE_NAME: "ghcr.io/codemicro/circuitbodge"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get tag version
id: get_version
run: echo "::set-output name=VERSION::$(echo ${GITHUB_REF/refs\/tags\//} | sed "s/^v//")"
- name: Make image tags
id: make_tags
run: |
echo "::set-output name=LATEST::$IMAGE_NAME:latest"
echo "::set-output name=VERSIONED::$IMAGE_NAME:${{ steps.get_version.outputs.VERSION }}"
- name: Build Docker image
run: docker build . --file Dockerfile --tag ${{ steps.make_tags.outputs.LATEST }} --tag ${{ steps.make_tags.outputs.VERSIONED }}
- name: Login to ghcr.io
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io --username codemicro --password-stdin
- name: Push image
run: docker push --all-tags $IMAGE_NAME