-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (40 loc) · 1.63 KB
/
deploy-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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:
deploy:
runs-on: ubuntu-latest
permissions:
packages: write
contents: write # Write is required to create/update releases
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Perform pre-release actions
uses: danielemery/github-release-action/perform-pre-release@main
id: pre_release
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
release-version: ${{ env.RELEASE_VERSION }}
- 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: danielemery/github-release-action/perform-post-release@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
release-id: ${{ steps.pre_release.outputs.releaseId }}