Skip to content

Commit 960a680

Browse files
authored
Merge pull request #7 from opf/maintenance/trigger-deploys
Auto-trigger deploys for dev and release branches
2 parents c85c152 + c977fbd commit 960a680

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

.github/workflows/docker.yml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Set SHORT_SHA
14-
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
14+
run: |
15+
echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
16+
echo "DOCKER_TAG=${{ github.ref_name }}-${{ env.SHORT_SHA }}" >> $GITHUB_ENV
1517
1618
- name: Login to Docker Hub
1719
uses: docker/login-action@v3
@@ -28,9 +30,38 @@ jobs:
2830
push: true
2931
tags: |
3032
openproject/hocuspocus:latest
31-
openproject/hocuspocus:${{ github.ref_name }}-${{ env.SHORT_SHA }}
33+
openproject/hocuspocus:${{ env.DOCKER_TAG }}
3234
cache-from: type=gha
3335
cache-to: type=gha,mode=max
3436
- name: Summarize build
3537
run: |
36-
echo "Built \`openproject/hocuspocus:${{ github.ref_name }}-${{ env.SHORT_SHA }}\`" >> $GITHUB_STEP_SUMMARY
38+
echo "Built \`openproject/hocuspocus:${{ env.DOCKER_TAG }}\`" >> $GITHUB_STEP_SUMMARY
39+
40+
- name: Generate GHA token
41+
id: generate-gha-token
42+
uses: actions/create-github-app-token@v1
43+
with:
44+
app-id: ${{ vars.DEPLOY_APP_ID }}
45+
private-key: ${{ secrets.DEPLOY_APP_PRIVATE_KEY }}
46+
owner: opf
47+
repositories: saas-deploy
48+
49+
- name: Deploy EDGE
50+
if: github.ref == 'refs/heads/dev'
51+
uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc
52+
with:
53+
workflow: edge-deploy-shards.yml
54+
repo: opf/saas-deploy
55+
ref: master
56+
inputs: '{ "hocuspocus_image_tag": "${{ env.DOCKER_TAG }}" }'
57+
token: "${{ steps.generate-gha-token.outputs.token }}"
58+
59+
- name: Deploy STAGE
60+
if: github.ref == 'refs/heads/release'
61+
uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc
62+
with:
63+
workflow: stage-deploy-shards.yml
64+
repo: opf/saas-deploy
65+
ref: master
66+
inputs: '{ "hocuspocus_image_tag": "${{ env.DOCKER_TAG }}" }'
67+
token: "${{ steps.generate-gha-token.outputs.token }}"

0 commit comments

Comments
 (0)