Переглянути джерело

[cli] Add release workflow (#681)

@ua741 I've done a test run, it seems to be working fine. You can use it
to release cli by pushing the `cli-v0.1.11` tag. This'll create a draft
release, which we can then publish.
Manav Rathi 1 рік тому
батько
коміт
748e715ae8
2 змінених файлів з 50 додано та 36 видалено
  1. 50 0
      .github/workflows/cli-release.yml
  2. 0 36
      cli/.github/workflows/release.yml

+ 50 - 0
.github/workflows/cli-release.yml

@@ -0,0 +1,50 @@
+name: "Release (cli)"
+
+on:
+    push:
+        # Run when a tag matching the pattern "cli-v*"" is pushed
+        #
+        # Tip: to test this workflow, push at tag with a pre-release version,
+        # e.g. `cli-v1.2.3-test`, where 1.2.3 is the expected version number of
+        # the next release that'll go out.
+        tags:
+            - "cli-v*"
+
+jobs:
+    draft-release:
+        runs-on: ubuntu-latest
+        steps:
+            - name: Create a draft GitHub release
+              uses: ncipollo/release-action@v1
+              with:
+                  prerelease: true
+                  draft: true
+
+    build:
+        runs-on: ubuntu-latest
+        needs: draft-release
+
+        strategy:
+            matrix:
+                goos: [linux, windows, darwin]
+                goarch: ["386", amd64, arm64]
+                exclude:
+                    - goarch: "386"
+                      goos: darwin
+
+        steps:
+            - name: Checkout code
+              uses: actions/checkout@v4
+
+            - name: Build binaries and add to the release
+              uses: wangyoucao577/go-release-action@v1
+              with:
+                  github_token: ${{ secrets.GITHUB_TOKEN }}
+                  goos: ${{ matrix.goos }}
+                  goarch: ${{ matrix.goarch }}
+                  asset_name: ente-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.goarch }}
+                  release_name: ${{ github.ref_name }}
+                  goversion: "1.20"
+                  project_path: "./cli"
+                  md5sum: false
+                  sha256sum: true

+ 0 - 36
cli/.github/workflows/release.yml

@@ -1,36 +0,0 @@
-name: Release
-
-on:
-  # allow manual run
-  push:
-    tags:
-      - 'v*.*.*'  # This will run the workflow when you push a new tag in the format v0.0.0
-      - 'v*.*.*-beta.*'
-
-jobs:
-  goreleaser:
-    runs-on: ubuntu-latest
-    steps:
-      - name: Install latest Syft
-        run: |
-          wget $(curl -s https://api.github.com/repos/anchore/syft/releases/latest | grep 'browser_' | grep 'linux_amd64.rpm' | cut -d\" -f4) -O syft_latest_linux_amd64.rpm
-          sudo rpm -i syft_latest_linux_amd64.rpm
-
-      - name: Checkout code
-        uses: actions/checkout@v4
-        with:
-          fetch-depth: 0  # Important to ensure that GoReleaser works correctly
-
-      - name: Set up Go
-        uses: actions/setup-go@v4
-        with:
-          go-version: '1.20'  # You can adjust the Go version here
-
-      - name: Run GoReleaser
-        uses: goreleaser/goreleaser-action@v5
-        with:
-          distribution: goreleaser
-          version: latest
-          args: release --rm-dist
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  # Use the provided GITHUB_TOKEN secret