Skip to content

Commit

Permalink
Release/Tag Workflow followup fixes (chainguard-dev#256)
Browse files Browse the repository at this point in the history
Signed-off-by: egibs <[email protected]>
  • Loading branch information
egibs authored Jun 10, 2024
1 parent 9d54aab commit 3371511
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,20 @@ jobs:
- name: Get Version
id: get-version
run: |
CURRENT_VERSION=$(awk -F'"' '/ID string =/ {print $2}' ${{ env.VERSION_FILE }})
echo "VERSION=$CURRENT_VERSION" >> "$GITHUB_OUTPUT"
VERSION=$(awk -F'"' '/ID string =/ {print $2}' ${{ env.VERSION_FILE }})
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
- name: Create Tag
if: ${{ steps.get-version.outputs.VERSION != '' }}
run: |
if [ $(git tag -l "${{ steps.get-version.outputs.VERSION }}") ]; then
echo "Tag already exists for version $CURRENT_VERSION"
VERSION=${{ steps.get-version.outputs.VERSION }}
if [ $(git tag -l "$VERSION") ]; then
echo "Tag already exists for version $VERSION"
exit 0
else
git config --global tag.gpgsign true
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag $CURRENT_VERSION
git push --tags
git tag $VERSION
git push origin tag $VERSION
gitsign verify $(git rev-list --tags --max-count=1) --certificate-identity-regexp="https://github.com/${{ github.repository }}" --certificate-oidc-issuer="https://token.actions.githubusercontent.com"
fi
10 changes: 7 additions & 3 deletions .github/workflows/version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,20 @@ jobs:
exit 1
;;
esac
echo "Current bincapz version: $CURRENT_VERSION"
echo "New bincapz version: $VERSION"
sed -i'' -e "s/ID string = \"v[0-9]*\.[0-9]*\.[0-9]*\"/ID string = \"v$VERSION\"/" ${{ env.VERSION_FILE }}
sed -i -e "s/ID string = \"v[0-9]*\.[0-9]*\.[0-9]*\"/ID string = \"v$VERSION\"/" ${{ env.VERSION_FILE }}
- name: Commit Version Update
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -b bincapz-version-bump-$VERSION
BRANCH="bincapz-version-bump-$VERSION"
git checkout -b $BRANCH
git add ${{ env.VERSION_FILE }}
git commit -m "Bump bincapz version to v$VERSION"
git push origin bincapz-bump-version-$VERSION
git push origin $BRANCH
gitsign verify $(git rev-parse HEAD) --certificate-identity-regexp="https://github.com/${{ github.repository }}" --certificate-oidc-issuer="https://token.actions.githubusercontent.com"
- name: Create Pull Request
run: |
Expand Down

0 comments on commit 3371511

Please sign in to comment.