From 3f67000fd889e46899baeaeceb483aa18c68d4c8 Mon Sep 17 00:00:00 2001 From: Stavros Date: Tue, 26 Nov 2024 22:30:48 +0200 Subject: [PATCH] feat: add beta and release workflows --- .github/workflows/beta-release.yml | 65 ++++++++++++++++++++++++++++++ .github/workflows/release.yml | 62 ++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 .github/workflows/beta-release.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/beta-release.yml b/.github/workflows/beta-release.yml new file mode 100644 index 0000000..ba7b1ee --- /dev/null +++ b/.github/workflows/beta-release.yml @@ -0,0 +1,65 @@ +name: Beta Release +on: + workflow_dispatch: + inputs: + alpha: + description: 'Beta version (e.g. 1, 2, 3)' + required: true + +jobs: + get-tag: + runs-on: ubuntu-latest + outputs: + tag: ${{ steps.tag.outputs.name }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Get tag + id: tag + run: echo "name=$(cat internal/assets/version)-beta.${{ github.event.inputs.alpha }}" >> $GITHUB_OUTPUT + + + build: + runs-on: ubuntu-latest + strategy: + matrix: + arch: [amd64, arm64] + os: [linux] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version: 1.23.2 + + - name: Build + run: go build -o tipicord-${{ matrix.os }}-${{ matrix.arch }} + env: + GOARCH: ${{ matrix.arch }} + GOOS: ${{ matrix.os }} + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: tipicord-${{ matrix.os }}-${{ matrix.arch }} + path: tipicord-${{ matrix.os }}-${{ matrix.arch }} + + beta-release: + needs: [get-tag, build] + runs-on: ubuntu-latest + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + pattern: tipicord-* + path: binaries + merge-multiple: true + + - name: Create beta release + uses: softprops/action-gh-release@v2 + with: + prerelease: true + tag_name: ${{ needs.get-tag.outputs.tag }} + files: binaries/* diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2144912 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,62 @@ +name: Release +on: + workflow_dispatch: + +jobs: + get-tag: + runs-on: ubuntu-latest + outputs: + tag: ${{ steps.tag.outputs.name }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Get tag + id: tag + run: echo "name=$(cat internal/assets/version)" >> $GITHUB_OUTPUT + + + build: + runs-on: ubuntu-latest + strategy: + matrix: + arch: [amd64, arm64] + os: [linux] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version: 1.23.2 + + - name: Build + run: go build -o tipicord-${{ matrix.os }}-${{ matrix.arch }} + env: + GOARCH: ${{ matrix.arch }} + GOOS: ${{ matrix.os }} + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: tipicord-${{ matrix.os }}-${{ matrix.arch }} + path: tipicord-${{ matrix.os }}-${{ matrix.arch }} + + release: + needs: [get-tag, build] + runs-on: ubuntu-latest + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + pattern: tipicord-* + path: binaries + merge-multiple: true + + - name: Create release + uses: softprops/action-gh-release@v2 + with: + prerelease: false + make_latest: false + tag_name: ${{ needs.get-tag.outputs.tag }} + files: binaries/*