release #6
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: Gitea Release | |
on: | |
push: | |
branches: [main] | |
paths: | |
- "gitea.json" | |
jobs: | |
Build_New_Version_For_Release: | |
runs-on: ubuntu-latest | |
env: | |
CI: false | |
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: npm install | |
- name: Build | |
run: yarn build | |
- name: Update CHANGELOG.md and public/manifest.json | |
id: update_data | |
run: | | |
version=$(jq -r '.Version' gitea.json) | |
echo "PLUGIN_VERSION=$version" >> $GITHUB_OUTPUT | |
real_version=${version%%-*} | |
echo "VERSION=$real_version" >> $GITHUB_ENV | |
echo "RC_VERSION=$version" >> $GITHUB_ENV | |
if [[ $version == *-* ]]; then | |
echo "release version" | |
echo "::set-output name=release::false" | |
else | |
echo "rc release version" | |
echo "::set-output name=release::true" | |
fi | |
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 "## $version release on $current_date\n$changelog\n$(cat CHANGELOG.md)" > temp.txt | |
mv temp.txt CHANGELOG.md | |
jq -r --arg version "$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 gitea | |
cp CHANGELOG.md gitea | |
cp gitea.json gitea | |
cp -r docs gitea | |
rsync -av --exclude='changelog_latest.md' *.md gitea/ | |
zip -r gitea-${{ env.VERSION }}.zip gitea/ | |
cp CHANGELOG.md artifacts/ | |
cp gitea.json artifacts/ | |
mv gitea-${{ env.VERSION }}.zip artifacts/ | |
cp artifacts/gitea-${{ env.VERSION }}.zip artifacts/gitea-latest.zip | |
- name: Upload To Azure Blob | |
uses: LanceMcCarthy/Action-AzureBlobUpload@v2 | |
if: ${{ steps.update_data.outputs.release == 'false' }} | |
with: | |
connection_string: ${{ secrets.AZURE_STORAGE_ARTIFACT }} | |
container_name: dev | |
source_folder: artifacts/ | |
destination_folder: ./websoft9/plugin/gitea | |
delete_if_exists: true | |
fail_if_source_empty: true | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
if: ${{ steps.update_data.outputs.release == 'false' }} | |
with: | |
files: /* | |
tag_name: ${{ env.RC_VERSION }} | |
title: Release-${{ env.RC_VERSION }} | |
body: ${{ steps.update_data.outputs.CHANGELOG }} | |
draft: false | |
prerelease: false | |
- name: Upload To Azure Blob | |
uses: LanceMcCarthy/Action-AzureBlobUpload@v2 | |
if: ${{ steps.update_data.outputs.release == 'true' }} | |
with: | |
connection_string: ${{ secrets.AZURE_STORAGE_ARTIFACT }} | |
container_name: release | |
source_folder: artifacts/ | |
destination_folder: ./websoft9/plugin/gitea | |
delete_if_exists: true | |
fail_if_source_empty: true | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
if: ${{ steps.update_data.outputs.release == 'true' }} | |
with: | |
files: /* | |
tag_name: ${{ env.VERSION }} | |
title: Release-${{ env.VERSION }} | |
body: ${{ steps.update_data.outputs.CHANGELOG }} | |
draft: false | |
prerelease: false |