Skip to content

Commit

Permalink
Node20 actions update (#66)
Browse files Browse the repository at this point in the history
* Update actions to use node 20 versions and new tag workflow

* Dependency Updates
  • Loading branch information
a1ecbr0wn authored Feb 18, 2024
1 parent 6b1da97 commit 3ab601e
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 31 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,24 @@ env:

jobs:
format:
name: "Rust Format Check"
name: Rust Format Check
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4

- name: "Rust Toolchain setup"
- name: Rust Toolchain setup
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt

- name: "Format Check"
- name: Format Check
uses: mbrobbel/rustfmt-check@master
with:
token: ${{ secrets.GITHUB_TOKEN }}

build-linux:
name: "CI Build - Linux"
name: CI Build - Linux
runs-on: ubuntu-latest
needs: format
strategy:
Expand All @@ -56,10 +56,10 @@ jobs:
- aarch64-unknown-linux-gnu

steps:
- name: "Checkout"
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4

- name: "Rust Toolchain setup"
- name: Rust Toolchain setup
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.RUST }}
Expand All @@ -75,7 +75,7 @@ jobs:
run: cross test --target=${{ matrix.TARGET }}

build-macos:
name: "CI Build - Macos"
name: CI Build - Macos
runs-on: macos-latest
needs: format
strategy:
Expand All @@ -85,10 +85,10 @@ jobs:
- x86_64-apple-darwin
- aarch64-apple-darwin
steps:
- name: "Checkout"
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4

- name: "Rust Toolchain setup"
- name: Rust Toolchain setup
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.RUST }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
security-events: write
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Tag Release Build
name: Release Binaries on Tag

on:
push:
Expand All @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Rust Toolchain setup
uses: dtolnay/rust-toolchain@stable
Expand All @@ -28,7 +28,7 @@ jobs:

# Build the Linux release artifacts
tag-release-build-linux:
name: Tag Release Build - Linux
name: Build tag as a release - Linux
runs-on: ubuntu-latest
needs: format
strategy:
Expand All @@ -41,7 +41,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Toolchain setup
uses: dtolnay/rust-toolchain@master
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:

# Build the MacOS release artifacts
tag-release-build-macos:
name: Tag Release Build - MacOS
name: Build tag as a release - MacOS
runs-on: macos-latest
needs: format
strategy:
Expand All @@ -88,7 +88,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Toolchain setup
uses: dtolnay/rust-toolchain@stable
Expand Down Expand Up @@ -123,14 +123,14 @@ jobs:

# Publishing to crates.io - this will be skipped if the tag as a '-' in it for testing purposes
tag-release-publish:
name: Tag Release Publish
name: Publish tag as a release
runs-on: ubuntu-latest
needs: [tag-release-build-linux, tag-release-build-macos]
if: github.ref_type == 'tag' && ( contains(github.ref_name, '-') == false )

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Publish Application to crates.io
env:
Expand All @@ -139,13 +139,13 @@ jobs:

# Package the artifacts as a release package
tag-release-package:
name: Tag Release Package
name: Package tag as a release
runs-on: ubuntu-latest
needs: [tag-release-build-linux, tag-release-build-macos]

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Download all release artifacts from the workflow
uses: actions/download-artifact@v3
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
name: Tag a release

on:
workflow_dispatch:
inputs:

version:
description: 'Tag to apply, in the form "v0.0.0"'
required: true

jobs:
tag-release:
name: Given the tag input value, check the value, update the version number of the application, commit, tag, push tag
runs-on: ubuntu-latest

steps:
- name: Check the version number from input
run: |
echo "Validating that tag is a tag is in the correct format v0.0.1"
input_version="${{ github.event.inputs.version }}"
if grep -P '^v[0-9]+\.[0-9]+\.[0-9]+' <<< "${input_version}"; then
echo "tag=${input_version}" >> $GITHUB_ENV
echo "cargo_version=version = \"${input_version:1}\"" >> $GITHUB_ENV
elif grep -P '^[0-9]+\.[0-9]+\.[0-9]+' <<< "${input_version}"; then
echo "tag=v${input_version}" >> $GITHUB_ENV
echo "cargo_version=version = \"${input_version}\"" >> $GITHUB_ENV
else
false
fi
- name: Setup GPG
run: |
echo "${{ secrets.SIGNINGKEY }}" | gpg --import
- name: Checkout code
uses: actions/checkout@v4

- name: Setup git config
run: |
# setup the username and email.
git config user.name "Tag Bot"
git config user.email "[email protected]"
# setup gpg configuration
git config commit.gpgsign true
git config user.signingkey ${{ secrets.SIGNINGKEYHASH }}
- name: Replace the version number in the Cargo.toml files
run: |
sed -i 's/^version = .*/${{ env.cargo_version }}/g' Cargo.toml
- name: Add, push, tag, push
run: |
git add .
git commit -S -m "Release ${{ env.tag }}"
git push -f
git tag ${{ env.tag }} -s -m "Release ${{ env.tag }}"
git push origin ${{ env.tag }} -f
- name: Release Tag Repository Dispatch
uses: benc-uk/workflow-dispatch@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
repo: ${{env.GITHUB_REPOSITORY}}
ref: refs/tags/${{ env.tag }}
workflow: release.yml
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ path = "src/main.rs"
name = "bookmark-cd"

[dependencies]
clap = { version = "4.4", features = ["derive"] }
clap = { version = "4.5", features = ["derive"] }
csv = "1.3"
home = "0.5.9"
tabled = "0.15.0"
pshell = "1.0.11"
pshell = "1.0.12"
snapcraft = "0.3.0"

[build-dependencies]
clap = { version = "4.4", features = ["derive"] }
clap_complete = "4.4"
clap_complete_fig = "4.4"
clap = { version = "4.5", features = ["derive"] }
clap_complete = "4.5"
clap_complete_fig = "4.5"
home = "0.5.9"
pshell = "1.0.10"
pshell = "1.0.12"
snapcraft = "0.3.0"
2 changes: 1 addition & 1 deletion src/init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ fn instructions_shell_script(init_file: PathBuf, eval: String) {

fn setup_init_file(interactive: bool, init_file: PathBuf, eval: String) -> bool {
if init_file.exists() {
let res = OpenOptions::new().write(true).append(true).open(init_file);
let res = OpenOptions::new().append(true).open(init_file);
match res {
Ok(mut file) => {
writeln!(file).unwrap();
Expand Down

0 comments on commit 3ab601e

Please sign in to comment.