Build New Version For Dev #2
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: Build New Version For Dev | |
on: workflow_dispatch | |
jobs: | |
Build_New_Version_For_Dev: | |
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: Copy logos to build | |
run: cp -R logos/ build/static/ | |
- name: Update CHANGELOG.md and public/manifest.json | |
id: update_data | |
run: | | |
version=$(jq -r '.Version' myapps.json) | |
echo "PLUGIN_VERSION=$version" >> $GITHUB_OUTPUT | |
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 Dev | |
- name: Create Zip Archive | |
run: | | |
mkdir artifacts | |
mv build myapps | |
cp myapps.json myapps | |
cp CHANGELOG.md myapps | |
cp -r docs myapps | |
rsync -av --exclude='changelog_latest.md' *.md myapps/ | |
zip -r myapps-${{ steps.update_data.outputs.PLUGIN_VERSION }}.zip myapps/ | |
cp CHANGELOG.md artifacts/ | |
cp myapps.json artifacts/ | |
mv myapps-${{ steps.update_data.outputs.PLUGIN_VERSION }}.zip artifacts/ | |
- name: Upload To Azure Blob | |
uses: LanceMcCarthy/Action-AzureBlobUpload@v2 | |
with: | |
connection_string: ${{ secrets.AZURE_STORAGE_ARTIFACT }} | |
container_name: dev | |
source_folder: artifacts/ | |
destination_folder: ./websoft9/plugin/myapps | |
delete_if_exists: true | |
fail_if_source_empty: true | |
- name: Checkout websoft9 | |
uses: actions/checkout@v2 | |
with: | |
repository: Websoft9/websoft9 | |
ref: main | |
- name: Update Version in websoft9/version.json | |
run: | | |
jq -r --arg version "${{ steps.update_data.outputs.PLUGIN_VERSION }}" '.PLUGINS.MYAPPS = $version' version.json > version.json.tmp | |
mv version.json.tmp version.json | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.ZJ_ADMIN_TOKEN }} | |
branch: update-portainer-version-${{ github.run_number }} | |
delete-branch: true | |
commit-message: Myapps Release New Version | |
title: "Myapps Releases New Version : ${{ steps.update_data.outputs.PLUGIN_VERSION }}" | |
body: ${{ steps.update_data.outputs.CHANGELOG }} |