From 5acd72f070a1f147ae42a785866aa3b0e28e30ee Mon Sep 17 00:00:00 2001 From: Nicolas Meienberger Date: Sat, 20 Jan 2024 15:50:37 +0100 Subject: [PATCH] chore: debug pipeline --- .github/workflows/build.yml | 97 +++++++++++++++++++++++++++++-------- 1 file changed, 76 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ba4a117..8398fa8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,33 +7,58 @@ on: required: true type: string description: "The version of the CLI to build (e.g. v1.6.0-beta.1)" + distinct_id: + type: string + description: "Distinct ID" + required: false jobs: + test: + runs-on: ubuntu-latest + steps: + - name: echo distinct ID ${{ github.event.inputs.distinct_id }} + run: echo ${{ github.event.inputs.distinct_id }} + + create-tag: + runs-on: ubuntu-latest + needs: [test] + outputs: + tagname: ${{ inputs.version }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - uses: rickstaa/action-create-tag@v1 + id: create-tag + with: + tag: ${{ inputs.version }} + build: + needs: [create-tag] name: Release - ${{ matrix.platform.release_for }} strategy: matrix: platform: - - release_for: Linux-aarch64 + - release_for: linux-aarch64 os: ubuntu-20.04 target: aarch64-unknown-linux-gnu bin: runtipi-cli - name: runtipi-cli-Linux-aarch64.tar.gz + name: runtipi-cli-linux-arm64 command: build - - release_for: Linux-x86_64 + - release_for: linux-x86_64 os: ubuntu-20.04 target: x86_64-unknown-linux-gnu bin: runtipi-cli - name: runtipi-cli-Linux-x86_64.tar.gz + name: runtipi-cli-linux-x64 command: build - - release_for: macOS-aarch64 - os: macOS-latest - target: aarch64-apple-darwin - bin: runtipi-cli - name: runtipi-cli-Darwin-aarch64.tar.gz - command: build + # - release_for: macOS-aarch64 + # os: macOS-latest + # target: aarch64-apple-darwin + # bin: runtipi-cli + # name: runtipi-cli-Darwin-aarch64 + # command: build runs-on: ${{ matrix.platform.os }} steps: @@ -42,7 +67,7 @@ jobs: - name: Set version in src/assets/VERSION run: | - echo "${{ inputs.version }}" > src/assets/VERSION + echo "${{ needs.create-tag.outputs.tagname }}" > src/assets/VERSION - name: Build binary uses: houseabsolute/actions-rust-cross@v0 @@ -52,6 +77,9 @@ jobs: args: "--locked --release" strip: true + - name: List artifacts + run: tree target + - name: Upload CLI uses: actions/upload-artifact@v4 with: @@ -60,24 +88,51 @@ jobs: release: runs-on: ubuntu-latest - needs: build + needs: [build, create-tag] steps: - - uses: rickstaa/action-create-tag@v1 - with: - tag: ${{ inputs.version }} + - name: Checkout + uses: actions/checkout@v3 + + - name: Download all artifacts + uses: actions/download-artifact@v4 + + - name: List artifacts + run: tree . + + - name: Move artifacts + run: for dir in runtipi-cli-linux-*; do mv "$dir/runtipi-cli" "${dir}.cli" && rm -rf "$dir" && mv "${dir}.cli" "$dir"; done + + - name: List artifacts + run: tree . - name: Create release - uses: actions/create-release@v1 id: create_release + uses: softprops/action-gh-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: ${{ inputs.version }} - release_name: ${{ inputs.version }} + body: | + **${{ needs.create-tag.outputs.tagname }}** + tag_name: ${{ needs.create-tag.outputs.tagname }} + name: ${{ needs.create-tag.outputs.tagname }} draft: false prerelease: true + files: runtipi-cli-* - - name: Download CLI artifacts - uses: actions/download-artifact@v2 + teardown: + runs-on: ubuntu-latest + if: failure() + needs: [build, release] + steps: + - name: Delete tag + uses: actions/github-script@v7 with: - name: runtipi-cli-*.tar.gz + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const tag = '${{ needs.create-tag.outputs.tagname }}'; + + github.rest.git.deleteRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: `tags/${tag}` + });