-
Notifications
You must be signed in to change notification settings - Fork 567
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add CHANGELOG.md for web releases
- Loading branch information
Showing
1 changed file
with
25 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
name: create capa Explorer Web release | ||
|
||
name: create web release | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
|
@@ -19,12 +18,12 @@ jobs: | |
- uses: actions/checkout@v4 | ||
|
||
- name: Set release name | ||
run: echo "RELEASE_NAME=capa-explorer-web-${{ github.event.inputs.version }}-${GITHUB_SHA::7}" >> $GITHUB_ENV | ||
run: echo "RELEASE_NAME=capa-explorer-web-v${{ github.event.inputs.version }}-${GITHUB_SHA::7}" >> $GITHUB_ENV | ||
|
||
- name: Check if release already exists | ||
run: | | ||
if ls web/explorer/releases/capa-explorer-web-${{ github.event.inputs.version }}-* 1> /dev/null 2>&1; then | ||
echo "A release with version ${{ github.event.inputs.version }} already exists" | ||
if ls web/explorer/releases/capa-explorer-web-v${{ github.event.inputs.version }}-* 1> /dev/null 2>&1; then | ||
echo "::error:: A release with version ${{ github.event.inputs.version }} already exists" | ||
exit 1 | ||
fi | ||
|
@@ -50,18 +49,31 @@ jobs: | |
- name: Create releases directory | ||
run: mkdir -vp web/explorer/releases | ||
|
||
- name: Move archive release to releases folder | ||
- name: Move release to releases folder | ||
run: mv web/explorer/${{ env.RELEASE_NAME }}.zip web/explorer/releases | ||
|
||
- name: Commit and push release | ||
- name: Compute release SHA256 hash | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "Capa Bot" | ||
git add -f web/explorer/releases/${{ env.RELEASE_NAME }}.zip | ||
git commit -m "explorer web: add release ${{ env.RELEASE_NAME }}" | ||
git push | ||
echo "RELEASE_SHA256=$(sha256sum web/explorer/releases/${{ env.RELEASE_NAME }}.zip | awk '{print $1}')" >> $GITHUB_ENV | ||
- name: Update CHANGELOG.md | ||
run: | | ||
echo "## ${{ env.RELEASE_NAME }}" >> web/explorer/releases/CHANGELOG.md | ||
echo "- Release Date: $(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> web/explorer/releases/CHANGELOG.md | ||
echo "- SHA256: ${{ env.RELEASE_SHA256 }}" >> web/explorer/releases/CHANGELOG.md | ||
echo "" >> web/explorer/releases/CHANGELOG.md | ||
cat web/explorer/releases/CHANGELOG.md | ||
- name: Remove older releases | ||
# keep only the latest 3 releases | ||
run: ls -t capa-explorer-web-*.zip | tail -n +4 | xargs -r rm -- | ||
run: ls -t capa-explorer-web-v*.zip | tail -n +4 | xargs -r rm -- | ||
working-directory: web/explorer/releases | ||
|
||
- name: Commit and push release | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "Capa Bot" | ||
git add -f web/explorer/releases/${{ env.RELEASE_NAME }}.zip web/explorer/releases/CHANGELOG.md | ||
git add -u web/explorer/releases/ | ||
git commit -m ":robot: explorer web: add release ${{ env.RELEASE_NAME }}" | ||
git push |