Skip to content

Commit

Permalink
Merge pull request #1575 from simonbaird/keep-github-releases
Browse files Browse the repository at this point in the history
Keep versioned GitHub releases
  • Loading branch information
simonbaird authored May 1, 2024
2 parents 7913d4e + 915295d commit 003ad7f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
22 changes: 17 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ jobs:
GH_TOKEN: ${{ github.token }}
GH_COBRA: 1
run: |
echo head_sha=$(gh api /repos/enterprise-contract/ec-cli/git/matching-refs/heads/main --jq '.[0].object.sha') >> "$GITHUB_OUTPUT"
echo head_sha=$(gh api /repos/enterprise-contract/ec-cli/git/matching-refs/heads/main --jq '.[0].object.sha') | tee -a "$GITHUB_OUTPUT"
- name: Timestamp
id: timestamp
run: |
echo timestamp=$(date '+%s') >> "$GITHUB_OUTPUT"
echo timestamp=$(date '+%s') | tee -a "$GITHUB_OUTPUT"
release:

Expand Down Expand Up @@ -144,6 +144,7 @@ jobs:
# uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5

- name: Delete snapshot release and tag
id: add_tags
run: |
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
RELEASE_ID=$(gh api \
Expand All @@ -157,15 +158,26 @@ jobs:
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git tag -a -f -m 'Development snapshot' snapshot
source hack/add-auto-tag.sh
echo "tag_name=$( source hack/derive-version.sh )" | tee -a "$GITHUB_OUTPUT"
git push -f --tags
- name: Release
- name: Versioned release
uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 # v2.0.4
with:
name: ${{ steps.add_tags.outputs.tag_name }}
tag_name: ${{ steps.add_tags.outputs.tag_name }}
generate_release_notes: false
files: dist/*

- name: Rolling release
uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 # v2.0.4
with:
prerelease: true
make_latest: true
name: Rolling release
body: Stable rolling release. Version can be determined by running `ec version`
body: Stable rolling release. Version can be determined by running `ec version`.
tag_name: snapshot
generate_release_notes: false
files: dist/*
2 changes: 1 addition & 1 deletion hack/add-auto-tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ AUTO_TAG=$(hack/derive-version.sh)
if [ -z "$(git tag -l $AUTO_TAG)" ]; then
# Create a tag
echo "Creating tag $AUTO_TAG"
git tag -a -m 'Version tag added automatically after snapshot build' "$AUTO_TAG"
git tag -a -m 'Version tag added automatically after snapshot build.' "$AUTO_TAG"

else
# The tag exists already
Expand Down

0 comments on commit 003ad7f

Please sign in to comment.