fix missing HEAD_SHA and try cache #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust Build | |
on: [push] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
targets: ['x86_64-unknown-linux-musl', 'x86_64-unknown-linux-gnu'] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly | |
override: true | |
- name: Install musl-tools | |
run: sudo apt-get update && sudo apt-get install -y musl-tools | |
- name: Build | |
run: | | |
rustup target add ${{ matrix.targets }} | |
cargo build --release --target=${{ matrix.targets }} | |
cp target/${{ matrix.targets }}/release/otk otk-${{ matrix.targets }} | |
- name: Cache Dependencies | |
uses: Swatinem/rust-cache@d30f1144e884b1fe579845ed7a339c640dff522e | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: otk-${{ matrix.targets }} | |
path: otk-${{ matrix.targets }} | |
release: | |
name: publish | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Nodejs | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- run: echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV | |
- run: 'echo "HEAD_SHA: $HEAD_SHA"' | |
- uses: actions/download-artifact@v1 | |
with: | |
name: otk-x86_64-unknown-linux-musl | |
path: ./dist | |
- uses: actions/download-artifact@v1 | |
with: | |
name: otk-x86_64-unknown-linux-gnu | |
path: ./dist | |
- run: ls -al ./dist | |
- name: Publish Release | |
uses: ./.github/actions/github-release | |
with: | |
files: "dist/*" | |
name: latest | |
token: ${{ secrets.GITHUB_TOKEN }} |