Skip to content

release: nightly 0.1.1 #6

release: nightly 0.1.1

release: nightly 0.1.1 #6

Workflow file for this run

name: Draft Nightly Image
on:
push:
branches:
- "release-nightly-*"
pull_request:
branches:
- "release-nightly-*"
types: [opened, synchronize, closed]
env:
CARGO_TERM_COLOR: always
jobs:
release_image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Install buildx
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
# Set buildx cache
- name: Cache register
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: buildx-cache
# Extract branch info
- name: Set info
run: |
echo "BRANCH_NAME=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV
echo "CHANNEL=$(echo ${GITHUB_REF##*/} | awk -F- '{print $2}')" >> $GITHUB_ENV
echo "VERSION=$(echo ${GITHUB_REF##*/} | awk -F- '{print $3}')" >> $GITHUB_ENV
# Print info for debug
- name: Print Info
run: |
echo $BRANCH_NAME
echo $CHANNEL
echo $VERSION
# Build daemon image
- name: Build image
run: docker buildx build --load --cache-from type=local,src=/tmp/.buildx-cache --cache-to type=local,dest=/tmp/buildx-cache --build-arg channel=$CHANNEL -t ghcr.io/nxthat/nhsf:$VERSION-$CHANNEL -f ./Dockerfile .
# Export it as tar.gz
- name: Export image
run: docker save ghcr.io/nxthat/nhsf:$VERSION-$CHANNEL | gzip > /tmp/nhsf-$VERSION-$CHANNEL.tar.gz
# Upload it to release
- name: Test if release already exists
id: release-exists
continue-on-error: true
run: gh release view -R nxthat/nhsf $VERSION-$CHANNEL
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 -R nxthat/nhsf -t $VERSION-$CHANNEL -d $VERSION-$CHANNEL -F changelog.md /tmp/nhsf-$VERSION-$CHANNEL.tar.gz#nhsf-image;
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 -R nxthat/nhsf -y nhsf-$VERSION-$CHANNEL nhsf-$VERSION-$CHANNEL.tar.gz || true
gh release upload -R nxthat/nhsf nhsf-$VERSION-$CHANNEL /tmp/nhsf-$VERSION-$CHANNEL.tar.gz#nhsf-image
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}