fix: version #5
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 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.78.0-alpine3.20 | |
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 next-hat/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 next-hat/c2ncl -y $BINARY_NAME-$VERSION ${BINARY_NAME}_${VERSION}_amd64.deb || true | |
gh release upload -R next-hat/c2ncl $BINARY_NAME-$VERSION target/debian/${BINARY_NAME}_${VERSION}_amd64.deb#c2ncl_amd64.deb | |
env: | |
GH_TOKEN: ${{ secrets.BOT_TOKEN }} |