Skip to content

Commit

Permalink
chore: debug pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
nicotsx committed Jan 21, 2024
1 parent b4720c1 commit 5acd72f
Showing 1 changed file with 76 additions and 21 deletions.
97 changes: 76 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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}`
});

0 comments on commit 5acd72f

Please sign in to comment.