chore: changelog #56
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: vmain | |
on: | |
push: | |
branches: [main] | |
jobs: | |
build: | |
# Prevent running this on forks | |
if: github.repository_owner == 'headwindsim' | |
runs-on: ubuntu-22.04 | |
env: | |
MAIN_PRE_RELEASE_ID: 101378539 | |
MAIN_PRE_RELEASE_TAG: vmain | |
ASSET_PATH: dist/Headwind_Installer_Setup.exe | |
ASSET_NAME: Headwind_Installer_Setup.exe | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '20.9' | |
- name: Create .sentrydsn file | |
run: | | |
echo ${{ secrets.SENTRY_DSN_INSTALLER }} >> ./extraResources/.sentrydsn | |
- name: Set BUILT_DATE_TIME | |
run: echo "BUILT_DATE_TIME=$(date -u -Iseconds)" >> $GITHUB_ENV | |
- name: Install NPM dependencies | |
run: npm ci | |
- name: Install system requirements | |
run: sudo dpkg --add-architecture i386 && sudo apt-get update && sudo apt-get install -y --allow-downgrades libc6:i386 libgcc-s1:i386 libstdc++6:i386 && sudo apt-get install -y wine32 wine64 | |
- name: Package installer | |
run: | | |
npm run package && rm -rf ./dist/win-unpacked/ | |
- name: Upload to CloudFlare CDN (dev) | |
env: | |
CLOUDFLARE_WORKER_PASSWORD: ${{ secrets.CLOUDFLARE_WORKER_PASSWORD }} | |
run: ./scripts/cdn-cf.sh installer/dev ./dist | |
- name: Get and delete main pre-release zip asset | |
run: | | |
echo 'checking for first release asset...' | |
assets=$( \ | |
curl --location --request GET \ | |
--url https://api.github.com/repos/${{ github.repository }}/releases/${{ env.MAIN_PRE_RELEASE_ID }}/assets | |
) | |
if [ $(echo $assets | jq '.[0].size') -eq '0' ]; then | |
echo 'no asset to delete' | |
else | |
assetId=$(echo $assets | jq '.[0].id') | |
echo 'deleting asset '$assetId | |
curl --request DELETE \ | |
--url https://api.github.com/repos/${{ github.repository }}/releases/assets/$assetId \ | |
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | |
fi | |
- name: Upload release binary | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: https://uploads.github.com/repos/${{ github.repository }}/releases/${{ env.MAIN_PRE_RELEASE_ID }}/assets{?name,label} | |
asset_path: ${{ env.ASSET_PATH }} | |
asset_name: ${{ env.ASSET_NAME }} | |
asset_content_type: application/x-msdos-program | |
- name: Update main pre-release body | |
run: | | |
curl --request PATCH \ | |
--url 'https://api.github.com/repos/${{ github.repository }}/releases/${{ env.MAIN_PRE_RELEASE_ID }}' \ | |
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ | |
--header 'Content-Type: application/json' \ | |
--data-raw '{ | |
"body": "This pre-release has its ${{ env.ASSET_NAME }} asset updated on every commit to the main branch\nDo not use the source code assets, they are never updated\nLast updated on ${{ env.BUILT_DATE_TIME }} from commit ${{ github.sha }}\nThis link will always point to the latest main build: https://github.com/${{ github.repository }}/releases/download/${{ env.MAIN_PRE_RELEASE_TAG }}/${{ env.ASSET_NAME }}" | |
}' |