name: build-and-release run-name: Build #${{ github.run_number }} on: push: branches: [main] workflow_dispatch: jobs: build: runs-on: windows-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Install dependencies run: npm ci - name: Build run: npm run build - name: Smoke test run: node dist/app.js - name: Package shell: pwsh run: | $tag = "v0.1.${{ github.run_number }}" Compress-Archive -Path dist\* -DestinationPath "test-runner-$tag.zip" echo "TAG=$tag" >> $env:GITHUB_ENV - name: Create Gitea release with artifact shell: pwsh env: GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | $repo = "${{ github.repository }}" $tag = $env:TAG $server = "${{ gitea.server_url }}" $headers = @{ Authorization = "token $env:GITEA_TOKEN" } $body = @{ tag_name = $tag name = "Test build $tag" target_commitish = "${{ github.sha }}" draft = $false prerelease = $true } | ConvertTo-Json $release = Invoke-RestMethod -Method Post -Uri "$server/api/v1/repos/$repo/releases" -Headers $headers -Body $body -ContentType "application/json" Write-Host "Created release id=$($release.id) tag=$tag" $zip = Get-Item "test-runner-$tag.zip" Invoke-RestMethod -Method Post -Uri "$server/api/v1/repos/$repo/releases/$($release.id)/assets?name=$($zip.Name)" -Headers $headers -Form @{ attachment = $zip } Write-Host "Uploaded asset $($zip.Name)"