fix version name #66
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: appstore Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
paths: | |
- "appstore.json" | |
jobs: | |
Build_New_Version_For_Release: | |
runs-on: ubuntu-latest | |
env: | |
CI: false | |
appname: appstore | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 20.2.0 | |
- name: Install dependencies | |
run: yarn | |
- name: Build | |
run: yarn build | |
- name: Version convert | |
id: convert_version | |
run: | | |
version=$(jq -r '.Version' "${{ env.appname }}.json") | |
version_core=${version%%-*} | |
echo "VERSION=$version" >> $GITHUB_OUTPUT | |
echo "VERSION_CORE=$version_core" >> $GITHUB_OUTPUT | |
if [[ $version == *-* ]]; then | |
echo "rc release version" | |
echo "CHANNEL=dev" >> $GITHUB_OUTPUT | |
else | |
echo "release version" | |
echo "CHANNEL=release" >> $GITHUB_OUTPUT | |
fi | |
- name: Update CHANGELOG.md and public/manifest.json | |
id: update_data | |
run: | | |
changelog=$(cat changelog_latest.md) | |
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT | |
echo "$changelog" >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
current_date=$(date +%Y-%m-%d) | |
printf "## ${{ steps.convert_version.outputs.VERSION }} release on $current_date\n$changelog\n$(cat CHANGELOG.md)" > temp.txt | |
mv temp.txt CHANGELOG.md | |
jq -r --arg version "${{ steps.convert_version.outputs.VERSION }}" '.version = $version' public/manifest.json > manifest.json.tmp | |
mv manifest.json.tmp public/manifest.json | |
- name: Commit and push changes | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Build Plugin For Release | |
- name: Create Zip Archive | |
run: | | |
mkdir artifacts | |
mv build ${{ env.appname }} | |
cp CHANGELOG.md ${{ env.appname }} | |
cp ${{ env.appname }}.json ${{ env.appname }} | |
cp -r docs ${{ env.appname }} | |
rsync -av --exclude='changelog_latest.md' *.md ${{ env.appname }}/ | |
zip -r ${{ env.appname }}-${{ steps.convert_version.outputs.VERSION_CORE }}.zip ${{ env.appname }}/ | |
cp CHANGELOG.md artifacts/ | |
cp ${{ env.appname }}.json artifacts/ | |
mv ${{ env.appname }}-${{ steps.convert_version.outputs.VERSION_CORE }}.zip artifacts/ | |
cp artifacts/${{ env.appname }}-${{ steps.convert_version.outputs.VERSION_CORE }}.zip artifacts/${{ env.appname }}-latest.zip | |
- name: Upload To Azure Blob | |
uses: LanceMcCarthy/Action-AzureBlobUpload@v2 | |
with: | |
connection_string: ${{ secrets.AZURE_STORAGE_ARTIFACT }} | |
container_name: ${{ steps.convert_version.outputs.CHANNEL }} | |
source_folder: artifacts/ | |
destination_folder: ./websoft9/plugin/${{ env.appname }} | |
delete_if_exists: true | |
fail_if_source_empty: true | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
${{ env.appname }}.json | |
tag_name: ${{ steps.convert_version.outputs.VERSION }} | |
title: Release-${{ steps.convert_version.outputs.VERSION }} | |
body: ${{ steps.update_data.outputs.CHANGELOG }} | |
draft: false | |
prerelease: false |