-
-
Notifications
You must be signed in to change notification settings - Fork 46
64 lines (60 loc) · 2.41 KB
/
draft_stable_nanocl.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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.72.0-alpine3.18
steps:
# Install required dependencies
- name: Install dependencies
run: |
apk add --update alpine-sdk musl-dev g++ make libpq-dev openssl-dev git upx 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
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 upload $BINARY_NAME-$VERSION target/debian/${BINARY_NAME}_${VERSION}_amd64.deb#nanocl_amd64.deb
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}