Skip to content

Commit

Permalink
Update restop.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
aeghn committed Nov 24, 2024
1 parent cc7d61e commit 773771c
Showing 1 changed file with 82 additions and 30 deletions.
112 changes: 82 additions & 30 deletions .github/workflows/restop.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,85 @@
name: restop
# credits: https://github.com/It4innovations/hyperqueue/blob/498a162e9f17506bfe4a274f7afe2773bb25c0ee/.github/workflows/release.yml

on: [push]
name: Create release

on:
workflow_dispatch:
inputs:
sha:
description: "Commit SHA to create release from"
required: true
tag:
description: "Tag of the release"
required: true
push:
tags:
- "v*"

jobs:
build-linux-musl:
runs-on: ubuntu-latest
steps:
- name: Setup Config
id: config
run: |
echo ::set-output name=SOURCE_TAG::${GITHUB_REF/refs\/tags\//}
echo ::set-output name=TARGET_NAME::x86_64-unknown-linux-musl
- uses: actions/checkout@master
- name: Build
uses: stevenleadbeater/rust-musl-builder@master
with:
args: /bin/bash -c "export DESTINY_API_KEY=${{ secrets.DESTINY_API_KEY }} && rustup toolchain install 1.65.0 && rustup target add x86_64-unknown-linux-musl --toolchain=1.65.0 && rustup override set 1.65.0 && cargo build --manifest-path=src/Cargo.toml --release --target=x86_64-unknown-linux-musl"
- name: Process and Package
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
env:
SOURCE_TAG: ${{ steps.config.outputs.SOURCE_TAG }}
TARGET_NAME: ${{ steps.config.outputs.TARGET_NAME }}
run: echo SOURCE_TAG ${SOURCE_TAG} && echo TARGET_NAME ${TARGET_NAME} && ls -l src/target/ && cp src/target/${TARGET_NAME}/release/restop . && zip -j restop_${TARGET_NAME}_${SOURCE_TAG}.zip restop

- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
restop_${{ steps.config.outputs.TARGET_NAME }}_${{ steps.config.outputs.SOURCE_TAG }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
create-release:
runs-on: ubuntu-20.04
steps:
- name: Show GLIBC
run: ldd --version

- name: Checkout sources
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.sha || env.GITHUB_SHA }}

- name: Set env on push
if: github.event_name == 'push'
run: |
echo "INPUT_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
echo "INPUT_TAG=$(git tag --points-at HEAD)" >> $GITHUB_ENV
- name: Set env on trigger
if: github.event_name == 'workflow_dispatch'
run: |
echo "INPUT_SHA=${{ github.event.inputs.sha }}" >> $GITHUB_ENV
echo "INPUT_TAG=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- uses: Swatinem/rust-cache@v1

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release

- name: Prepare archive
run: |
strip target/release/restop
export ARCHIVE_NAME=restop-${{ env.INPUT_TAG }}-linux-x64.tar.gz
echo "ARCHIVE_NAME=$ARCHIVE_NAME" >> $GITHUB_ENV
tar -czvf $ARCHIVE_NAME -C target/release restop
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.INPUT_TAG }}
release_name: ${{ env.INPUT_TAG }}
body: Restop ${{ env.INPUT_TAG }}
commitish: ${{ env.INPUT_SHA }}
draft: false
prerelease: false

- name: Upload scheduler binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.ARCHIVE_NAME }}
asset_name: ${{ env.ARCHIVE_NAME }}
asset_content_type: application/tar+gzip

0 comments on commit 773771c

Please sign in to comment.