Skip to content

fix copypaste artefacts #50

fix copypaste artefacts

fix copypaste artefacts #50

Workflow file for this run

name: release
on:
push:
tags:
- "*"
jobs:
init:
runs-on: ubuntu-latest
outputs:
release-version: ${{ steps.init.outputs.release-version }}
matrix: ${{ steps.init.outputs.matrix }}
targets: ${{ steps.init.outputs.targets }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- id: init
run: |
MATRIX=$(jq -Mc . .github/workflows/release_matrix.json)
TARGETS=$(jq -Mc '.include | map(.target)' <<<${MATRIX})
echo "release-version=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
echo "matrix=${MATRIX}" >> "$GITHUB_OUTPUT"
echo "targets=${TARGETS}" >> "$GITHUB_OUTPUT"
build-release:
name: build-release
runs-on: ${{ matrix.os }}
needs: init
env:
STAGING: remindee-bot-${{ needs.init.outputs.release-version }}-${{ matrix.target }}
BINARY_PATH: target/${{ matrix.target }}/release/${{ matrix.binary }}
strategy:
matrix: ${{ fromJSON(needs.init.outputs.matrix) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Setup cross
run: |
cargo install cross
- name: Build release binary
run: cross build --verbose --release --target ${{ matrix.target }}
- name: Strip release binary
if: ${{ ! matrix.is_arm }}
run: strip ${{ env.BINARY_PATH }}
- name: Strip ARM release binary
if: ${{ matrix.is_arm }}
run: |
sudo apt-get update
sudo apt-get install -y binutils-arm-linux-gnueabihf
arm-linux-gnueabihf-strip ${{ env.BINARY_PATH }}
- name: Build archive
shell: bash
run: |
mkdir ${{ env.STAGING }}
cp ${{ env.BINARY_PATH }} ${{ env.STAGING }}/
tar czf ${{ env.STAGING }}.tar.gz ${{ env.STAGING }}/
- uses: actions/upload-artifact@v3
with:
name: ${{ env.STAGING }}
path: ${{ env.STAGING }}.tar.gz
create-release:
name: create-release
needs: [init, build-release]
runs-on: ubuntu-latest
strategy:
matrix:
include:
- targets: ${{ fromJSON(needs.init.outputs.targets) }}
env:
PREFIX: remindee-bot-${{ needs.init.outputs.release-version }}
steps:
- uses: actions/download-artifact@v3
with:
name: ${{ env.PREFIX }}-${{ matrix.targets[0] }}
- uses: actions/download-artifact@v3
with:
name: ${{ env.PREFIX }}-${{ matrix.targets[1] }}
- uses: actions/download-artifact@v3
with:
name: ${{ env.PREFIX }}-${{ matrix.targets[2] }}
- uses: actions/download-artifact@v3
with:
name: ${{ env.PREFIX }}-${{ matrix.targets[3] }}
- uses: actions/download-artifact@v3
with:
name: ${{ env.PREFIX }}-${{ matrix.targets[4] }}
- name: Create release
uses: softprops/action-gh-release@v1
with:
files: |
${{ env.PREFIX }}-${{ matrix.targets[0] }}.tar.gz
${{ env.PREFIX }}-${{ matrix.targets[1] }}.tar.gz
${{ env.PREFIX }}-${{ matrix.targets[2] }}.tar.gz
${{ env.PREFIX }}-${{ matrix.targets[3] }}.tar.gz
${{ env.PREFIX }}-${{ matrix.targets[4] }}.tar.gz
publish-crate:
name: Publish tagged release on crates.io
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}