Skip to content

0.0.5

0.0.5 #11

name: Nginx Release
on:
push:
branches: [main]
paths:
- "nginx.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' nginx.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 nginx
cp CHANGELOG.md nginx
cp nginx.json nginx
cp -r docs nginx
rsync -av --exclude='changelog_latest.md' *.md nginx/
zip -r nginx-${{ env.VERSION }}.zip nginx/
cp CHANGELOG.md artifacts/
cp nginx.json artifacts/
mv nginx-${{ env.VERSION }}.zip artifacts/
cp artifacts/nginx-${{ env.VERSION }}.zip artifacts/nginx-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/nginx
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/nginx
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