chore: update installer #30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Draft Stable Nanocl | |
on: | |
push: | |
branches: | |
- "release/stable/bin/nanocl/**" | |
pull_request: | |
branches: | |
- "release/stable/bin/nanocl/**" | |
types: [opened, synchronize] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
release_image: | |
runs-on: ubuntu-latest | |
container: rust:1.78.0-alpine3.19 | |
steps: | |
# Install required dependencies | |
- name: Install dependencies | |
run: | | |
apk add --update alpine-sdk musl-dev g++ make libpq-dev openssl-dev git perl build-base dpkg pandoc github-cli | |
rustup target add x86_64-unknown-linux-musl | |
- uses: actions/checkout@v3 | |
# Extract branch info | |
- name: Set info | |
run: | | |
echo "CHANNEL=$(echo ${GITHUB_REF} | awk -F/ '{print $4}')" >> $GITHUB_ENV | |
echo "NANOCL_CHANNEL=$(echo ${GITHUB_REF} | awk -F/ '{print $4}')" >> $GITHUB_ENV | |
echo "BINARY_NAME=$(echo ${GITHUB_REF} | awk -F/ '{print $6}')" >> $GITHUB_ENV | |
echo "VERSION=$(echo ${GITHUB_REF} | awk -F/ '{print $7}')" >> $GITHUB_ENV | |
# Print info for debug | |
- name: Fix git permission | |
run: | | |
git config --global --add safe.directory /__w/nanocl/nanocl | |
- name: Print Info | |
run: | | |
echo $BRANCH_NAME | |
echo $BINARY_NAME | |
echo $CHANNEL | |
echo $VERSION | |
# Package nanocl into a .deb | |
- name: Package | |
run: ./scripts/release_nanocl.sh | |
- name: Test if release already exists | |
id: release-exists | |
continue-on-error: true | |
run: gh release view $BINARY_NAME-$VERSION | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | |
- name: Create new draft release | |
if: steps.release-exists.outcome == 'failure' && steps.release-exists.conclusion == 'success' | |
run: | | |
gh release create -d \ | |
$BINARY_NAME-$VERSION \ | |
-t $BINARY_NAME-$VERSION \ | |
-F ./bin/$BINARY_NAME/changelog.md \ | |
target/debian/${BINARY_NAME}_${VERSION}_amd64.deb#nanocl_amd64.deb \ | |
target/linux/${BINARY_NAME}_${VERSION}_amd64.tar.gz#nanocl_amd64.tar.gz | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | |
- name: Update draft release | |
if: steps.release-exists.outcome == 'success' && steps.release-exists.conclusion == 'success' | |
run: | | |
gh release delete-asset -y \ | |
$BINARY_NAME-$VERSION \ | |
${BINARY_NAME}_${VERSION}_amd64.deb || true | |
gh release delete-asset -y \ | |
$BINARY_NAME-$VERSION \ | |
${BINARY_NAME}_${VERSION}_amd64.tar.gz || true | |
gh release upload \ | |
$BINARY_NAME-$VERSION \ | |
target/debian/${BINARY_NAME}_${VERSION}_amd64.deb#nanocl_amd64.deb | |
gh release upload \ | |
$BINARY_NAME-$VERSION \ | |
target/linux/${BINARY_NAME}_${VERSION}_amd64.tar.gz#nanocl_amd64.tar.gz | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} |