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 jobs: deploy: name: Deploy to staging runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: ref: ${{ github.event.inputs.rev }} token: ${{ secrets.PUBLISH_TOKEN }} - run: | JOB_NAME=$(echo $JOB_NAME | sed 's|:|/|g') git fetch --all git branch --remote | grep $JOB_NAME || (git branch $JOB_NAME && git checkout $JOB_NAME && git push -u origin $JOB_NAME) if [[ ! $(git merge-base --is-ancestor $REV $JOB_NAME) ]]; then git checkout $JOB_NAME git reset --hard $REV git push --force fi env: JOB_NAME: ${{ github.event.inputs.job_name }} REV: ${{ github.event.inputs.rev }}