name: Release on: push: tags: - 'v*' jobs: build-and-release: runs-on: ubuntu-latest container: image: code.foss.global/host.today/ht-docker-node:latest steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Deno uses: denoland/setup-deno@v1 with: deno-version: v2.x - name: Get version from tag id: version run: | VERSION=${GITHUB_REF#refs/tags/} echo "version=$VERSION" >> $GITHUB_OUTPUT echo "version_number=${VERSION#v}" >> $GITHUB_OUTPUT - name: Verify deno.json version matches tag run: | DENO_VERSION=$(grep -o '"version": "[^"]*"' deno.json | cut -d'"' -f4) if [ "$DENO_VERSION" != "${{ steps.version.outputs.version_number }}" ]; then echo "deno.json version $DENO_VERSION does not match tag ${{ steps.version.outputs.version_number }}" exit 1 fi - name: Test run: deno task test - name: Compile binaries run: deno task compile - name: Generate checksums run: | cd dist/binaries sha256sum * > SHA256SUMS.txt cd ../.. - name: Create Gitea Release run: | VERSION="${{ steps.version.outputs.version }}" RELEASE_ID=$(curl -X POST -s \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Content-Type: application/json" \ "https://code.foss.global/api/v1/repos/uptime.link/uptimerunner/releases" \ -d "{\"tag_name\":\"$VERSION\",\"name\":\"uptimerunner $VERSION\",\"body\":\"Pre-compiled uptime.link runner binaries.\",\"draft\":false,\"prerelease\":false}" | jq -r '.id') for binary in dist/binaries/*; do filename=$(basename "$binary") curl -X POST -s \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Content-Type: application/octet-stream" \ --data-binary "@$binary" \ "https://code.foss.global/api/v1/repos/uptime.link/uptimerunner/releases/$RELEASE_ID/assets?name=$filename" done