nixos-config/.github/workflows/deploy.yml

30 lines
857 B
YAML
Raw Normal View History

2022-04-15 10:01:46 +00:00
name: Deploy to staging
on:
workflow_dispatch:
inputs:
job_name:
description: "Job name that has completed"
required: true
type: string
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
- 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 }}