Release 1.13.0. Web version #181
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
# build_stage.yaml | |
--- | |
name: Build and deploy | |
on: | |
pull_request: | |
types: [labeled] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
CSC_FOR_PULL_REQUEST: true | |
CI: true | |
S3_BUCKET: s3://spektr-stage-releases | |
STORING_DAYS: 60 | |
jobs: | |
internal-version-increment: | |
if: contains(github.event.label.name, 'internal-build') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get version from package.json | |
id: pkg | |
run: echo "::set-output name=version::$(node -p "require('./package.json').version")" | |
- name: Update version from secret | |
id: update_version | |
run: | | |
PKG_VERSION=${{ steps.pkg.outputs.version }} | |
INTERNAL_BUILD_VERSION=${{ secrets.INTERNAL_BUILD_VERSION }} | |
INTERNAL_BUILD_VERSION_BASE=${INTERNAL_BUILD_VERSION%-*} | |
if [[ $PKG_VERSION == "$INTERNAL_BUILD_VERSION_BASE" ]]; then | |
# Increment the last number of INTERNAL_BUILD_VERSION | |
NEW_VERSION=$(echo $INTERNAL_BUILD_VERSION | awk 'BEGIN{FS=OFS="-"} {n=split($NF, a, "."); if(n>1) $NF=a[1]"."a[2]+1; else $NF++;} 1') | |
else | |
NEW_VERSION="${PKG_VERSION}-1" | |
fi | |
echo "::set-output name=new_version::$NEW_VERSION" | |
shell: bash | |
- name: Write app version to secrets | |
uses: hmanzur/[email protected] | |
with: | |
name: 'INTERNAL_BUILD_VERSION' | |
value: ${{ steps.update_version.outputs.new_version }} | |
repository: novasamatech/nova-spektr | |
token: ${{ secrets.WRITE_SECRET_PAT }} | |
- name: Save nev version to artifacts | |
run: | | |
echo "${{ steps.update_version.outputs.new_version }}" > internal_version.txt | |
- name: Upload artifact with version | |
uses: actions/upload-artifact@v4 | |
with: | |
name: internal-version | |
path: | | |
internal_version.txt | |
internal-release-build: | |
runs-on: ${{ matrix.os }} | |
needs: internal-version-increment | |
timeout-minutes: 60 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, windows-latest, ubuntu-latest] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: internal-version | |
- name: Read internal-build version | |
id: internal-version | |
run: | | |
echo "::set-output name=version::$(cat internal_version.txt)" | |
- name: ⚙️ Install dependencies | |
uses: ./.github/workflows/install-pnpm | |
- name: Add MacOS certs | |
if: startsWith(matrix.os, 'macos') | |
run: chmod +x .github/add_cert_in_keychain.sh && .github/add_cert_in_keychain.sh | |
env: | |
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }} | |
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }} | |
- name: Update package.json | |
run: | | |
jq '.version = "${{ steps.internal-version.outputs.version }}"' package.json > temp.json && mv temp.json package.json | |
shell: bash | |
- name: Build app | |
env: | |
# secrets for notarization | |
APPLE_ID: ${{ secrets.APPLE_ID }} | |
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_ID_PASS }} | |
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
run: | | |
pnpm stage:sequence | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifacts-${{ matrix.os }} | |
path: | | |
release/dist/*.exe | |
release/dist/*.dmg | |
release/dist/*.AppImage | |
internal-release-distribute: | |
needs: internal-release-build | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: build-artifacts-* | |
merge-multiple: true | |
- name: Debug | |
run: ls -la | |
- name: Replace space and underscore by "-" | |
run: | | |
for file in *; do | |
if [ -f "$file" ]; then | |
# Replace both spaces and underscores with hyphens | |
new_name=$(echo "$file" | tr ' _' '-') | |
if [ "$new_name" != "$file" ]; then # Skip files with no spaces or underscores | |
mv "$file" "$new_name" | |
fi | |
fi | |
done | |
- name: ⚙️ Install dependencies | |
uses: ./.github/workflows/setup-s3cmd | |
with: | |
s3_region: pl-waw | |
s3_access_key: ${{ secrets.S3_ACCESS_KEY }} | |
s3_secret_key: ${{ secrets.S3_SECRET_KEY }} | |
- name: Interact with object storage | |
id: interact_with_storage | |
run: | | |
declare -A artifacts=(["windows_app"]="*.exe" ["macos_64_app"]="*arm64.dmg" ["linux_app"]="*.AppImage" ["macos_app"]="*[!arm64].dmg") | |
for artifact_name in "${!artifacts[@]}"; do | |
artifact_pattern=${artifacts[$artifact_name]} | |
for artifact in $artifact_pattern; do | |
if [ -f "$artifact" ]; then | |
s3cmd sync "$artifact" --acl-public --multipart-chunk-size-mb=150 "${{ env.S3_BUCKET }}/pr-${{ github.event.pull_request.number }}/$artifact" | |
url=$(s3cmd signurl "${{ env.S3_BUCKET }}/pr-${{ github.event.pull_request.number }}/$artifact" $(echo "`date +%s` + 3600 * 24 * ${{ env.STORING_DAYS }}" | bc)) | |
# Escape the URL and format it differently | |
echo "::set-output name=$artifact_name::<a href=\"$url\">$artifact</a>" | |
fi | |
done | |
done | |
- name: Notify Telegram channel | |
uses: appleboy/telegram-action@master | |
with: | |
to: ${{ secrets.TELEGRAM_TO_DEV }} | |
token: ${{ secrets.TELEGRAM_TOKEN }} | |
format: html | |
message: | | |
👨💻 Stage build was created successfully! | |
<b>Branch:</b> ${{ github.head_ref }} | |
<b>PR:</b> https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }} | |
- <b>Windows:</b> ${{ steps.interact_with_storage.outputs.windows_app }} | |
- <b>Linux:</b> ${{ steps.interact_with_storage.outputs.linux_app }} | |
- <b>MacOS:</b> ${{ steps.interact_with_storage.outputs.macos_app }} | |
- <b>MacOS_arm:</b> ${{ steps.interact_with_storage.outputs.macos_64_app }} | |
<b>Stage web:</b> https://spektr-stg.novasama-tech.org/ |