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:21:24 +00:00
|
|
|
- run: |
|
2022-04-16 08:31:23 +00:00
|
|
|
git tag --list | grep ${{ inputs.job_name }} || (git tag ${{ inputs.job_name }} ${{ inputs.rev }} && git push --tags)
|
|
|
|
git fetch --all --tags
|
|
|
|
if [[ ! git merge-base --is-ancestor ${{ inputs.rev }} ${{ inputs.job_name }} ]]; then
|
|
|
|
git tag -f ${{ inputs.job_name }} ${{ inputs.rev }}
|
|
|
|
git push --tags --force
|
|
|
|
fi
|