2022-04-15 10:01:46 +00:00
|
|
|
name: Deploy to staging
|
|
|
|
on:
|
2022-04-15 19:38:09 +00:00
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
job_name:
|
|
|
|
description: "Job name that has completed"
|
|
|
|
required: true
|
|
|
|
type: string
|
2022-04-16 08:21:24 +00:00
|
|
|
rev:
|
|
|
|
description: "Revision of succeeded comit"
|
|
|
|
required: true
|
|
|
|
type: string
|
2022-04-15 10:01:46 +00:00
|
|
|
jobs:
|
|
|
|
deploy:
|
|
|
|
name: Deploy to staging
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-04-15 19:56:22 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-04-16 08:39:39 +00:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.inputs.rev }}
|
2022-04-16 08:41:33 +00:00
|
|
|
token: ${{ secrets.PUBLISH_TOKEN }}
|
2022-04-16 08:21:24 +00:00
|
|
|
- run: |
|
2022-04-16 08:36:00 +00:00
|
|
|
JOB_NAME=$(echo $JOB_NAME | sed 's|:|/|g')
|
2022-04-16 08:31:23 +00:00
|
|
|
git fetch --all --tags
|
2022-04-16 08:36:42 +00:00
|
|
|
git tag --list | grep $JOB_NAME || (git tag $JOB_NAME $REV && git push --tags)
|
2022-04-16 08:34:37 +00:00
|
|
|
if [[ ! git merge-base --is-ancestor $REV $JOB_NAME ]]; then
|
|
|
|
git tag -f $JOB_NAME $REV
|
2022-04-16 08:31:23 +00:00
|
|
|
git push --tags --force
|
|
|
|
fi
|
2022-04-16 08:34:37 +00:00
|
|
|
env:
|
|
|
|
JOB_NAME: ${{ github.event.inputs.job_name }}
|
|
|
|
REV: ${{ github.event.inputs.rev }}
|