chore: tweak workflows for staging and production environments (#89) #12
Workflow file for this run
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*" | |
env: | |
IMAGE_NAME: unitystation/central-command | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract Tag Name | |
id: extract_tag | |
run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}" | |
- name: Build docker image with tag | |
run: | | |
docker pull $IMAGE_NAME:latest | |
docker build --pull --cache-from $IMAGE_NAME:latest -t $IMAGE_NAME:${{ steps.extract_tag.outputs.tag }} . | |
- name: Tag image as stable | |
run: | | |
docker tag $IMAGE_NAME:${{ steps.extract_tag.outputs.tag }} $IMAGE_NAME:stable | |
- name: Log in into Docker Hub | |
run: | | |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | |
- name: Push tagged image to registry | |
run: | | |
docker push $IMAGE_NAME:${{ steps.extract_tag.outputs.tag }} | |
- name: Push stable image to registry | |
run: | | |
docker push $IMAGE_NAME:stable |