Skip to content

Commit

Permalink
feat: Update github action and rerelease for cargo
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-engel committed Mar 14, 2020
1 parent 7aba039 commit 174c49a
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 29 deletions.
83 changes: 56 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,67 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@master
- name: Install Rust (macOS)
run: "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y"
if: matrix.os == 'macOS-latest'
- name: Configure cargo (macOS)
run: ln -s $HOME/.cargo/bin/cargo /usr/local/bin/cargo
if: matrix.os == 'macOS-latest'
- uses: actions/checkout@v2
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
override: true
- name: Run tests
run: cargo test --verbose
deploy_linux:
name: Build and release the project on linux
uses: actions-rs/cargo@v1
with:
command: test
- name: Run clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
deploy:
name: Build and release the project
if: startsWith(github.ref, 'refs/tags/')
needs: test
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@master
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT" && echo "$GITHUB_REF"
- uses: actions/checkout@v2
- name: Build
run: cargo build --release
- name: Pack
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features
- name: Pack (*nix)
run: tar czf ./jwt-cli.tar.gz target/release/jwt-cli
if: matrix.os != 'windows-latest'
- name: Pack (windows)
run: Compress-Archive target/release/jwt-cli.exe jwt-cli.zip
if: matrix.os == 'windows-latest'
shell: pwsh
- name: Create release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
- name: Upload
uses: actions/upload-release-asset@v1
if: matrix.os != 'windows-latest'
env:
TAG: $([[ ${{github.ref}} =~ ^refs/tags/(.+) ]] && ${BASH_REMATCH[1]})
run: tar czf ./jwt-$TAG-linux.tar.gz target/release/jwt-cli
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./jwt-cli.tar.gz
asset_name: jwt-cli-${{matrix.os}}.tar.gz
asset_content_type: application/tar+gzip
- name: Upload
uses: actions/upload-release-asset@v1
if: matrix.os == 'windows-latest'
env:
TAG: $([[ ${{github.ref}} =~ ^refs/tags/(.+) ]] && ${BASH_REMATCH[1]})
SIZE: $(stat -c %s ./jwt-$TAG-linux.tar.gz)
run: 'curl -sSL -XPOST -H "Authorization: token $GITHUB_TOKEN" -H "Content-Size: $SIZE" -H "Content-Type: application/zip" --upload-file ./jwt-$TAG-linux.tar.gz https://uploads.github.com/repos/mike-engel/releases/tag/${TAG}/assets?name=jwt-$TAG-linux.tar.gz'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./jwt-cli.zip
asset_name: jwt-cli-${{matrix.os}}.zip
asset_content_type: application/zip
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Unreleased

# 3.0.1

> 2020-03-14
#### Bug fixes

- Re-release for cargo installers

# 3.0.0

> 2020-03-14
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "jwt-cli"
description = "A super fast CLI tool to decode and encode JWTs built in Rust"
version = "3.0.0"
version = "3.0.1"
authors = ["Mike Engel <[email protected]>", "Corey McGregor <https://github.com/shousper>", "Aaron Schaef <https://github.com/atschaef>", "Hugh Simpson <https://github.com/hughsimpson>"]
edition = "2018"
license = "MIT"
Expand Down

0 comments on commit 174c49a

Please sign in to comment.