Deploy Release #21
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 Release | |
on: | |
workflow_dispatch: | |
# Ensure only one instance of either this is running at a time. | |
# This ensures that we don't put production into an inconsistent state. | |
concurrency: | |
group: "prod-deployment" | |
jobs: | |
prepare-production-deployment: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # Write is required to create a draft release | |
outputs: | |
release-id: ${{ steps.pre_release.outputs.release-id }} | |
is-existing-release: ${{ steps.pre_release.outputs.is-existing-release }} | |
steps: | |
- name: Perform pre-release actions | |
uses: abusix/github-release-actions/perform-pre-release@PLA-1131-additional-outputs | |
id: pre_release | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
release-version: ${{github.ref_name}} | |
- name: Echo the outputs | |
run: | | |
echo "release-id: ${{ steps.pre_release.outputs.release-id }}" | |
echo "is-existing-release: ${{ steps.pre_release.outputs.is-existing-release }}" | |
echo "release-url ${{ steps.pre_release.outputs.release-url }}" | |
deploy-production: | |
runs-on: ubuntu-latest | |
needs: prepare-production-deployment | |
permissions: | |
packages: write | |
contents: write # Write is required to delete intermediate releases and publish the final release | |
environment: production | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Deploy to Production | |
# To emulate deployments here we are simply shifting the latest tag to the appropriate docker image. | |
# In a real world scenario, you would replace this with your actual deployment steps. | |
run: | | |
docker pull ghcr.io/${{ github.repository }}:${{github.ref_name}} | |
docker tag ghcr.io/${{ github.repository }}:${{github.ref_name}} ghcr.io/${{ github.repository }}:latest | |
docker push ghcr.io/${{ github.repository }}:latest | |
- name: Perform post-release actions | |
uses: abusix/github-release-actions/perform-post-release@PLA-1131-additional-outputs | |
id: post_release | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
release-id: ${{ needs.prepare-production-deployment.outputs.release-id }} | |
- name: Echo the outputs | |
run: | | |
echo "release-url: ${{ steps.post_release.outputs.release-url }}" |