Skip to content

Commit

Permalink
release entirely from github
Browse files Browse the repository at this point in the history
  • Loading branch information
ciiqr committed Sep 27, 2023
1 parent 1ae175b commit e49bdf5
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 124 deletions.
61 changes: 44 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
name: build
on:
workflow_dispatch: # Manually trigger
push:
# TODO: uncomment
# tags:
# - v*
tags:
- v*
jobs:
build:
name: Build
strategy:
matrix:
build:
# TODO: uncomment
# - os: macos-latest
# path: target/release/nk
# artifact: nk-macos-x86_64
- os: macos-latest
path: target/release/nk
artifact: nk-macos-x86_64
- os: macos-latest
path: target/release/nk
artifact: nk-macos-aarch64
# TODO: stable-aarch64-apple-darwin
# - os: ubuntu-latest
# path: target/x86_64-unknown-linux-musl/release/nk
# artifact: nk-linux-x86_64
# - os: windows-latest
# path: target/release/nk.exe
# artifact: nk-windows-x86_64.exe
- os: ubuntu-latest
path: target/x86_64-unknown-linux-musl/release/nk
artifact: nk-linux-x86_64
- os: windows-latest
path: target/release/nk.exe
artifact: nk-windows-x86_64.exe
# TODO: aarch64-pc-windows-msvc
runs-on: ${{ matrix.build.os }}
steps:
Expand All @@ -50,10 +46,41 @@ jobs:
- name: Build
run: cargo build --release
if: runner.os != 'Linux' && matrix.build.artifact != 'nk-macos-aarch64'
- name: Print version
run: ${{ matrix.build.path }} --version
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.build.artifact }}
path: ${{ matrix.build.path }}
release:
name: Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
# TODO: temp
- name: DEBUG
run: tree -a
working-directory: artifacts
- name: Create Release
env:
GITHUB_USER: ${{ github.repository_owner }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# TODO:
false
# # move binaries to assets directory
# mv './target/release/nk' "${assets_dir}/nk-macos-aarch64"
# mv "${temp_dir}/nk-macos-x86_64/nk" "${assets_dir}/nk-macos-x86_64"
# mv "${temp_dir}/nk-linux-x86_64/nk" "${assets_dir}/nk-linux-x86_64"
# mv "${temp_dir}/nk-windows-x86_64.exe/nk.exe" "${assets_dir}/nk-windows-x86_64.exe"
# # create release
# gh release create \
# --title "$GITHUB_REF_NAME" \
# --notes '' \
# "$GITHUB_REF_NAME" \
# "${assets_dir}/"*
61 changes: 61 additions & 0 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: bump
on:
workflow_dispatch: # Manually trigger
inputs:
bump:
type: choice
description: How to bump version
options:
- minor
- major
- patch
jobs:
bump:
name: Bump
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# NOTE: needs a user token otherwise tag events won't be triggered
token: ${{ secrets.PAT_GITHUB }}
- name: install cargo-edit
run: cargo install cargo-edit
- name: Determine New Version
id: version
uses: zwaldowski/semver-release-action@v3
with:
dry_run: true
bump: ${{ github.event.inputs.bump }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Set Env
env:
VERSION: ${{ steps.version.outputs.version }}
TAG: v${{ steps.version.outputs.version }}
run: |
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "TAG=${TAG}" >> $GITHUB_ENV
- name: Wait for validate job to finish
uses: lewagon/wait-on-check-action@v1.3.1
with:
check-name: Validate
ref: ${{ github.ref }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Create Tag
env:
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
GIT_COMMITTER_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
run: |
echo '==> set version in code'
cargo set-version "$VERSION"
cargo generate-lockfile
echo '==> commit changes'
git add Cargo.toml Cargo.lock
git commit -m "bumped version to ${TAG}"
echo '==> commit tag'
git tag "$TAG"
git push
git push origin "$TAG"
15 changes: 0 additions & 15 deletions scripts/initial-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,6 @@

set -e

echo '==> install brew'
if ! type 'brew' > /dev/null 2>&1; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi

echo '==> install dependencies'
brew install \
gh \
jq

# TODO: is there a better alternative available in brew?
sudo curl --output /usr/local/bin/semver \
https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver
sudo chmod +x /usr/local/bin/semver

if ! type 'rustup' > /dev/null 2>&1; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s - -y --no-modify-path
fi
Expand Down
92 changes: 0 additions & 92 deletions scripts/release.sh

This file was deleted.

0 comments on commit e49bdf5

Please sign in to comment.