v0.4.0-beta.0 #23
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: Deploy | ||
on: | ||
release: | ||
types: [prereleased, released] | ||
concurrency: | ||
cancel-in-progress: false | ||
Check failure on line 8 in .github/workflows/cd.yml GitHub Actions / DeployInvalid workflow file
|
||
env: | ||
ENVIRONMENT: ${{ github.event.action == 'prereleased' && 'staging' || 'production' }} | ||
jobs: | ||
build-and-push: | ||
name: "Build and push docker image" | ||
runs-on: ubuntu-latest | ||
environment: ${{ env.ENVIRONMENT }} | ||
steps: | ||
- name: Print variables | ||
run: echo "${{ toJSON(vars)}}" | ||
- name: Print env | ||
run: echo "${{ toJSON(env)}}" | ||
- name: Print secrets | ||
run: echo "${{ toJSON(secrets)}}" | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build docker image (environment) | ||
run: | | ||
docker build -t ghcr.io/killmenot/github-test-${{ env.ENVIRONMENT }}:${{ github.event.release.tag_name }} -f Dockerfile . | ||
- name: Push docker image to GitHub Container Registry (environment) | ||
run: | | ||
docker push ghcr.io/killmenot/github-test-${{ env.ENVIRONMENT }}:${{ github.event.release.tag_name }} | ||
- name: Push docker image to GitHub Container Registry (production > staging) | ||
if: env.ENVIRONMENT == 'production' | ||
run: | | ||
docker push ghcr.io/killmenot/github-test-staging:${{ github.event.release.tag_name }} | ||