Skip to content

Commit

Permalink
Change force_push logic
Browse files Browse the repository at this point in the history
flag is appended in the push step when force_push is true
  • Loading branch information
rafaelfolco committed Aug 7, 2024
1 parent 47c0c50 commit b4bff0c
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions .github/workflows/crucible-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ on: # yamllint disable-line rule:truthy
force_push:
required: false
type: boolean
description: FORCE push (override if tag exists)
description: FORCE push (override tag)
default: false

jobs:
Expand All @@ -35,7 +35,6 @@ jobs:
timeout-minutes: 5
outputs:
tag: ${{ steps.gen-release-tag.outputs.tag }}
force: ${{ steps.get-force-push.outputs.force }}
steps:
- name: Generate release tag
id: gen-release-tag
Expand All @@ -48,14 +47,6 @@ jobs:
else
echo "tag=${{ inputs.custom_tag }}" >> $GITHUB_OUTPUT
fi
- name: Get force push flag
if: ${{ inputs.action == 'push' }}
id: get-force-push
run: |
if [ ${{ inputs.force_push == true }} ]; then
echo "force='-f'" >> $GITHUB_OUTPUT
else
echo "force=''" >> $GITHUB_OUTPUT
display-params:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -107,15 +98,18 @@ jobs:
if: ${{ inputs.dry_run == false }}
env:
TAG: ${{ needs.release-tag.outputs.tag }}
FORCE: ${{ needs.release-tag.outputs.force }}
run: |
cd $GITHUB_WORKSPACE
cd crucible
echo "Tags:"
git ls-remote --tags origin
if [ ${{ inputs.action == 'push' }} ]; then
git tag $TAG
git push origin $TAG $FORCE
if [ ${{ inputs.force_push == true }} ]; then
git push origin $TAG --force
else
git push origin $TAG
fi
elif [ ${{ inputs.action == 'delete' }} ]; then
git push --delete origin $TAG
fi
Expand Down Expand Up @@ -187,15 +181,18 @@ jobs:
if: ${{ inputs.dry_run == false }}
env:
TAG: ${{ needs.release-tag.outputs.tag }}
FORCE: ${{ needs.release-tag.outputs.force }}
run: |
cd $GITHUB_WORKSPACE
cd ${{ matrix.repository }}
echo "Tags:"
git ls-remote --tags origin
if [ ${{ inputs.action == 'push' }} ]; then
git tag $TAG
git push origin $TAG $FORCE
if [ ${{ inputs.force_push == true }} ]; then
git push origin $TAG --force
else
git push origin $TAG
fi
elif [ ${{ inputs.action == 'delete' }} ]; then
git push --delete origin $TAG
fi
Expand Down

0 comments on commit b4bff0c

Please sign in to comment.