diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a375c8b61..17985a170 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,73 +1,12 @@ name: Release on: - workflow_dispatch: - inputs: - tag: - description: "Release tag (e.g. v0.2.0)" - required: true - type: string - prerelease: - description: "Mark as pre-release" - required: false - type: boolean - default: false - draft: - description: "Create as draft" - required: false - type: boolean - default: false + release: + types: [created] jobs: - create-release: - name: Create Tag & Release - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Validate version - env: - TAG_VERSION: ${{ inputs.tag }} - run: | - FILE_VERSION=$(cat VERSION) - TAG_VERSION="${TAG_VERSION#v}" - if [ "$FILE_VERSION" != "$TAG_VERSION" ]; then - echo "::error::Tag ($TAG_VERSION) ≠ VERSION file ($FILE_VERSION). Run version-bump first." - exit 1 - fi - - - name: Create and push tag - env: - RELEASE_TAG: ${{ inputs.tag }} - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git tag -a "$RELEASE_TAG" -m "Release $RELEASE_TAG" - git push origin "$RELEASE_TAG" - - - name: Create release with generated notes - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - RELEASE_TAG: ${{ inputs.tag }} - IS_DRAFT: ${{ inputs.draft }} - IS_PRERELEASE: ${{ inputs.prerelease }} - run: | - FLAGS="" - if [ "$IS_DRAFT" = "true" ]; then FLAGS="$FLAGS --draft"; fi - if [ "$IS_PRERELEASE" = "true" ]; then FLAGS="$FLAGS --prerelease"; fi - gh release create "$RELEASE_TAG" \ - --generate-notes \ - --title "$RELEASE_TAG" \ - $FLAGS - build-go: name: Go Binaries - needs: create-release runs-on: ubuntu-latest permissions: contents: write @@ -76,7 +15,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - ref: ${{ inputs.tag }} + ref: ${{ github.event.release.tag_name }} - name: Setup Go uses: actions/setup-go@v5 @@ -89,7 +28,7 @@ jobs: - name: Upload binaries to release env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - RELEASE_TAG: ${{ inputs.tag }} + RELEASE_TAG: ${{ github.event.release.tag_name }} run: | gh release upload "$RELEASE_TAG" \ build/clawdroid-linux-amd64 \ @@ -98,7 +37,6 @@ jobs: build-android-termux: name: Android Termux APK - needs: create-release runs-on: ubuntu-latest permissions: contents: write @@ -109,7 +47,7 @@ jobs: - name: Checkout tag uses: actions/checkout@v4 with: - ref: ${{ inputs.tag }} + ref: ${{ github.event.release.tag_name }} - name: Set up JDK uses: actions/setup-java@v4 @@ -140,7 +78,7 @@ jobs: - name: Upload APK to release env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - RELEASE_TAG: ${{ inputs.tag }} + RELEASE_TAG: ${{ github.event.release.tag_name }} run: | mv app/build/outputs/apk/termux/release/app-termux-release.apk \ app/build/outputs/apk/termux/release/clawdroid-noembedded-"$RELEASE_TAG".apk @@ -149,7 +87,6 @@ jobs: build-android-embedded: name: Android Embedded APKs - needs: create-release runs-on: ubuntu-latest permissions: contents: write @@ -157,7 +94,7 @@ jobs: - name: Checkout tag uses: actions/checkout@v4 with: - ref: ${{ inputs.tag }} + ref: ${{ github.event.release.tag_name }} - name: Setup Go uses: actions/setup-go@v5 @@ -199,7 +136,7 @@ jobs: - name: Upload APKs to release env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - RELEASE_TAG: ${{ inputs.tag }} + RELEASE_TAG: ${{ github.event.release.tag_name }} working-directory: android/app/build/outputs/apk/embedded/release run: | mv app-embedded-arm64-v8a-release.apk clawdroid-"$RELEASE_TAG"-arm64-v8a.apk