chore(dev): update dependency pytest-env to v1 (#127) #220
This file contains 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: release | |
on: | |
push: | |
tags: | |
- v* | |
branches: | |
- master | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
env: | |
IMAGE: "ghcr.io/${{ github.repository_owner }}/ms-timeline" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.sha }} | |
cancel-in-progress: false | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- name: build base docker image | |
env: | |
TAG_HASH: "base-${{ hashFiles('poetry.lock', 'etc/*.dockerfile') }}" | |
run: | | |
echo "TAG_HASH=${TAG_HASH}" >>$GITHUB_ENV | |
if ! docker pull "${IMAGE}:${TAG_HASH}"; then | |
echo "NEED_BUILD_BASE=true" >>$GITHUB_ENV | |
else | |
echo "NEED_BUILD_BASE=false" >>$GITHUB_ENV | |
fi | |
- name: Build Base Docker Image (if needed) | |
uses: docker/build-push-action@v4 | |
if: ${{ fromJSON(env.NEED_BUILD_BASE) }} | |
with: | |
context: ./ | |
file: ./etc/base.dockerfile | |
provenance: false | |
push: true | |
tags: ${{ env.IMAGE }}:${{ env.TAG_HASH }} | |
- run: docker tag "${IMAGE}:${TAG_HASH}" base-image | |
- run: echo "SHA=$(git show --no-patch --no-notes --date=short-local --pretty='%as-%h')" >> $GITHUB_ENV | |
env: | |
TZ: UTC | |
- name: Docker metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.IMAGE }} | |
tags: | | |
type=semver,pattern=v{{version}} | |
type=ref,event=branch | |
type=sha,prefix={{branch}}- | |
type=ref,event=branch,suffix=-${{ env.SHA }} | |
type=raw,value=${{ env.SHA }} | |
- name: Build Final Docker Image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./ | |
provenance: false | |
file: ./etc/final.dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |