Skip to content

Commit

Permalink
Fix release CI and NPM CI (#509)
Browse files Browse the repository at this point in the history
  • Loading branch information
Milo123459 authored Jun 6, 2024
1 parent 829259c commit 2cd77ca
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 45 deletions.
36 changes: 8 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2

Expand All @@ -35,30 +31,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2

- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
run: cargo fmt --all -- --check

- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
# Set linting rules for clippy
args: --all-targets --all-features
run: cargo clippy --all-targets --all-features

test-plan:
name: Tests
Expand All @@ -71,14 +55,10 @@ jobs:
if: "!contains(github.event.head_commit.message, '(cargo-release)')"
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2

Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
name: Publish to NPM

on:
workflow_run:
workflows: [ "Release" ]
release:
types:
- completed
- published

jobs:
publish-npm:
if: github.event.workflow_run.conclusion == 'success'
name: Publish to NPM
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set version
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT

- name: Use Node.js 16
- name: Use Node.js 20
uses: actions/setup-node@v1
with:
node-version: 16
node-version: 20
registry-url: https://registry.npmjs.org/

- name: Setup Git user
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
echo "version is: ${{ env.CLI_VERSION }}"
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1

Expand Down Expand Up @@ -90,17 +90,13 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Install Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: ${{ matrix.target }}
profile: minimal
override: true
targets: ${{ matrix.target }}

- name: Build release binary
uses: actions-rs/cargo@v1
Expand All @@ -118,7 +114,7 @@ jobs:
cd -
- name: Prepare binaries (tar) [Windows]
if: matrix.os == 'windows-latest'
if: matrix.os == 'windows-latest' || matrix.target == 'i686-pc-windows-gnu'
run: |
cd target/${{ matrix.target }}/release
strip railway.exe
Expand All @@ -127,7 +123,7 @@ jobs:
cd -
- name: Prepare binaries [-linux]
if: matrix.os != 'windows-latest'
if: matrix.os != 'windows-latest' && matrix.target != 'i686-pc-windows-gnu'
run: |
cd target/${{ matrix.target }}/release
strip railway || true
Expand All @@ -142,6 +138,10 @@ jobs:
tag_name: ${{ needs.create-release.outputs.railway_version }}
files: railway-${{ needs.create-release.outputs.railway_version }}-${{ matrix.target }}*

- name: Install musl-tools
if: matrix.target == 'x86_64-unknown-linux-musl'
run: sudo apt-get update && sudo apt-get install -y musl-tools

- name: Install cargo-deb
if: matrix.target == 'x86_64-unknown-linux-musl'
run: cargo install cargo-deb
Expand Down

0 comments on commit 2cd77ca

Please sign in to comment.