Skip to content

Revert "update api version" #43

Revert "update api version"

Revert "update api version" #43

Workflow file for this run

name: vmain
on:
push:
branches: [main]
jobs:
build:
# Prevent running this on forks
if: github.repository_owner == 'headwindsim'
runs-on: ubuntu-latest
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: '16.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 eatmydata apt-get install ppa-purge
sudo eatmydata ppa-purge -y ppa:ubuntu-toolchain-r/test
sudo dpkg --add-architecture i386
sudo apt update
sudo DEBIAN_FRONTEND=noninteractive eatmydata apt install -y --no-install-recommends wine-stable 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 }}"
}'