GithubTagAndRelease #13
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
name: Github Tag and Release | |
run-name: GithubTagAndRelease | |
on: | |
push: | |
branches: ['main'] | |
concurrency: | |
group: 'githubrelease' | |
cancel-in-progress: true | |
jobs: | |
github: | |
name: Github Tag and Release | |
environment: github-pages | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Get Package Version | |
run: | | |
version=$(cat package.json | grep \"version\" | cut -d'"' -f 4) | |
echo "VERSION=${version}" >> $GITHUB_ENV | |
- name: Install npm packages | |
run: npm ci | |
- name: Build all projects | |
run: npm run build | |
- name: Generate release notes | |
run: | | |
version=${{ env.VERSION }} | |
mode="ignore" | |
filename="CHANGELOG.md" | |
while IFS="" read -r p || [ -n "$p" ] | |
do | |
if [[ $p == "## ["* ]]; then | |
mode="skip" | |
fi | |
if [[ $p == *"[$version]"* ]]; then | |
mode="add" | |
fi | |
if [[ $p == *"<!-- Links used in the page -->"* ]]; then | |
mode="add" | |
fi | |
if [[ $mode == "add" ]]; then | |
echo "$p" >> release.txt | |
fi | |
done < $filename | |
- name: Zip web files | |
uses: montudor/action-zip@v1 | |
with: | |
args: zip -qq -r web.zip dist | |
- name: Zip server files | |
uses: montudor/action-zip@v1 | |
with: | |
args: zip -qq -r server.zip build | |
- name: Push tag | |
uses: mathieudutour/github-tag-action@v6.1 | |
with: | |
github_token: ${{ secrets.CHECK_COMMIT_GITHUB_TOKEN }} | |
custom_tag: ${{ env.VERSION }} | |
- name: Create Release for Tag | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: '${{ env.VERSION }}' | |
tag_name: ${{ env.VERSION }} | |
body_path: ${{ github.workspace }}/release.txt | |
files: | | |
web.zip | |
server.zip |