-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
154 additions
and
73 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Draft Stable c2ncl | ||
|
||
on: | ||
push: | ||
branches: | ||
- "release-stable-*" | ||
pull_request: | ||
branches: | ||
- "release-stable-*" | ||
types: [opened, synchronize, closed] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
release_image: | ||
runs-on: ubuntu-latest | ||
container: rust:1.69.0-alpine3.17 | ||
|
||
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 "BINARY_NAME=c2ncl" >> $GITHUB_ENV | ||
echo "CHANNEL=$(echo ${GITHUB_REF##*/} | awk -F- '{print $2}')" >> $GITHUB_ENV | ||
echo "VERSION=$(echo ${GITHUB_REF##*/} | awk -F- '{print $3}')" >> $GITHUB_ENV | ||
# Fix git permission | ||
- name: Fix git permission | ||
run: | | ||
git config --global --add safe.directory /__w/c2ncl/c2ncl | ||
# Print info for debug | ||
- name: Print Info | ||
run: | | ||
echo $BINARY_NAME | ||
echo $CHANNEL | ||
echo $VERSION | ||
# Package c2ncl into a .deb | ||
- name: Package | ||
run: ./scripts/release.sh | ||
- name: Test if release already exists | ||
id: release-exists | ||
continue-on-error: true | ||
run: gh release view $BINARY_NAME-$VERSION | ||
env: | ||
GH_TOKEN: ${{ secrets.BOT_TOKEN }} | ||
- name: Create new draft release | ||
if: steps.release-exists.outcome == 'failure' && steps.release-exists.conclusion == 'success' | ||
run: gh release create -R nxthat/c2ncl -d $BINARY_NAME-$VERSION -t $BINARY_NAME-$VERSION -F changelog.md target/debian/${BINARY_NAME}_${VERSION}_amd64.deb#c2ncl_amd64.deb | ||
env: | ||
GH_TOKEN: ${{ secrets.BOT_TOKEN }} | ||
- name: Update draft release | ||
if: steps.release-exists.outcome == 'success' && steps.release-exists.conclusion == 'success' | ||
run: | | ||
gh release delete-asset -R nxthat/c2ncl -y $BINARY_NAME-$VERSION ${BINARY_NAME}_${VERSION}_amd64.deb || true | ||
gh release upload -R nxthat/c2ncl $BINARY_NAME-$VERSION target/debian/${BINARY_NAME}_${VERSION}_amd64.deb#c2ncl_amd64.deb | ||
env: | ||
GH_TOKEN: ${{ secrets.BOT_TOKEN }} |
Oops, something went wrong.