Update version.json #168
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: upload_artifact(decide by version) | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
paths: | |
- "version.json" | |
jobs: | |
upload_artifact: | |
name: Bupload_artifact | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
name: Check out code | |
- name: Version convert | |
id: convert_version | |
run: | | |
version=$(jq -r '.version' version.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 | |
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 | |
- name: Create Zip Archive | |
run: | | |
mkdir websoft9 artifacts | |
cp -r docker websoft9 | |
cp -r cockpit websoft9 | |
cp -r scripts websoft9 | |
cp -r install websoft9 | |
cp -r docs websoft9 | |
cp -r systemd websoft9 | |
cp *.md websoft9 | |
cp version.json websoft9 | |
zip -r websoft9-${{ steps.convert_version.outputs.VERSION_CORE }}.zip websoft9 | |
cp websoft9-${{ steps.convert_version.outputs.VERSION_CORE }}.zip artifacts | |
cp install/install.sh artifacts | |
cp version.json artifacts | |
cp CHANGELOG.md artifacts | |
cp artifacts/websoft9-${{ steps.convert_version.outputs.VERSION_CORE }}.zip artifacts/websoft9-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 | |
delete_if_exists: true | |
fail_if_source_empty: true | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
version.json | |
CHANGELOG.md | |
tag_name: ${{ steps.convert_version.outputs.VERSION }} | |
title: Release-${{ steps.convert_version.outputs.VERSION }} | |
body: ${{ steps.update_data.outputs.CHANGELOG }} | |
draft: false | |
prerelease: false |