Skip to content

Commit

Permalink
release: nightly 0.0.1 (#1)
Browse files Browse the repository at this point in the history
* release: nightly 0.0.1

* bugfix: draft nightly release

* bugfix: binary name

* bugfix: gh_token env name

* bugfix: nightly draft workflow

* bugfix: nightly draft workflow
  • Loading branch information
leon3s committed May 12, 2023
1 parent 5cf8f39 commit e5ce167
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/draft_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
# Extract branch info
- name: Set info
run: |
echo "BRANCH_NAME=c2ncl" >> $GITHUB_ENV
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
Expand All @@ -37,28 +37,27 @@ jobs:
# Print info for debug
- name: Print Info
run: |
echo $BRANCH_NAME
echo $BINARY_NAME
echo $CHANNEL
echo $VERSION
# Package c2ncl into a .deb
- name: Package
run: ./scripts/release_c2ncl.sh
run: ./scripts/release.sh
- name: Test if release already exists
id: release-exists
continue-on-error: true
run: gh release view $BINARY_NAME-$VERSION-$CHANNEL
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
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 -d $BINARY_NAME-$VERSION-$CHANNEL -t $BINARY_NAME-$VERSION-$CHANNEL -F changelog.md target/debian/${BINARY_NAME}_${VERSION}_amd64.deb#c2ncl_amd64.deb
run: gh release create -R nxthat/c2ncl -d $BINARY_NAME-$VERSION-$CHANNEL -t $BINARY_NAME-$VERSION-$CHANNEL -F changelog.md target/debian/${BINARY_NAME}_${VERSION}_amd64.deb#c2ncl_amd64.deb
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
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 -y $BINARY_NAME-$VERSION-$CHANNEL ${BINARY_NAME}_${VERSION}_amd64.deb || true
gh release upload $BINARY_NAME-$VERSION-$CHANNEL target/debian/${BINARY_NAME}_${VERSION}_amd64.deb#c2ncl_amd64.deb
gh release delete-asset -R nxthat/c2ncl -y $BINARY_NAME-$VERSION-$CHANNEL ${BINARY_NAME}_${VERSION}_amd64.deb || true
gh release upload -R nxthat/c2ncl $BINARY_NAME-$VERSION-$CHANNEL target/debian/${BINARY_NAME}_${VERSION}_amd64.deb#c2ncl_amd64.deb
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
GH_TOKEN: ${{ secrets.BOT_TOKEN }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Convert `docker-compose.yml` to `StateFile.yml`

```sh
$ c2ncl --help

Converts docker-compose.yml to nanocl StateFile.yml

Usage: c2ncl [OPTIONS]
Expand Down
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Convert `docker-compose.yml` to `StateFile.yml`
- Convert `docker-compose.yml` to Nanocl `StateFile.yml`
14 changes: 14 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,17 @@ cargo build --release --target x86_64-unknown-linux-musl

# Pack the binary to reduce size
upx --best --lzma ./target/x86_64-unknown-linux-musl/release/${pkg_name}

# Copy binary
cp ./target/x86_64-unknown-linux-musl/release/${pkg_name} "${release_path}"/usr/local/bin
# Generate DEBIAN controll
cat > "${release_path}"/DEBIAN/control <<- EOM
Package: ${pkg_name}
Version: ${version}
Architecture: ${arch}
Maintainer: Next Hat [email protected]
Description: Convert docker-compose.yaml to Nanocl StateFile.yml
EOM

mkdir -p ./target/debian
dpkg-deb --build --root-owner-group "${release_path}" ./target/debian/${pkg_name}_"${version}"_"${arch}".deb

0 comments on commit e5ce167

Please sign in to comment.