-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ci fix * fix readme * adding release process * removing builds * fixing ubuntu versinos * fixing checkouts * fixing names of binaries
- Loading branch information
1 parent
b82d013
commit 2f7ebd3
Showing
3 changed files
with
143 additions
and
11 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
on: | ||
push: | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+" | ||
|
||
jobs: | ||
create-release: | ||
name: create-release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Create artifacts directory | ||
run: mkdir artifacts | ||
|
||
- name: Get the release version from the tag | ||
if: env.VERSION == '' | ||
run: | | ||
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
echo "version is: ${{ env.VERSION }}" | ||
- name: Create GitHub release | ||
id: release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ env.VERSION }} | ||
release_name: ${{ env.VERSION }} | ||
|
||
- name: Save release upload URL to artifact | ||
run: echo "${{ steps.release.outputs.upload_url }}" > artifacts/release-upload-url | ||
|
||
- name: Save version number to artifact | ||
run: echo "${{ env.VERSION }}" > artifacts/release-version | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: artifacts | ||
path: artifacts | ||
|
||
build-release: | ||
name: build-release | ||
needs: ["create-release"] | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
# When CARGO is set to CROSS, TARGET_DIR includes matrix.target. | ||
TARGET_DIR: ./target | ||
# Emit backtraces on panics. | ||
RUST_BACKTRACE: 1 | ||
MACOSX_DEPLOYMENT_TARGET: 10.9 | ||
|
||
strategy: | ||
matrix: | ||
build: [linux, linux-static] | ||
include: | ||
- build: linux | ||
os: ubuntu-latest | ||
rust: stable | ||
target: x86_64-unknown-linux-gnu | ||
- build: linux-static | ||
os: ubuntu-latest | ||
rust: stable | ||
target: x86_64-unknown-linux-musl | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
name: Checkout repository | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Checkout submodule | ||
run: git submodule update --init --recursive | ||
|
||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
profile: minimal | ||
override: true | ||
target: ${{ matrix.target }} | ||
|
||
- name: Get release download URL | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: artifacts | ||
path: artifacts | ||
|
||
- name: Set release upload URL and release version | ||
shell: bash | ||
run: | | ||
release_upload_url="$(cat artifacts/release-upload-url)" | ||
echo "RELEASE_UPLOAD_URL=$release_upload_url" >> $GITHUB_ENV | ||
echo "release upload url: $RELEASE_UPLOAD_URL" | ||
release_version="$(cat artifacts/release-version)" | ||
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV | ||
echo "release version: $RELEASE_VERSION" | ||
- name: Build release binary | ||
if: matrix.build == 'linux' || matrix.build == 'macos' || matrix.build == 'windows' | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
toolchain: "${{ matrix.rust }}" | ||
args: --target ${{ matrix.target }} --release | ||
|
||
- name: Build release binary | ||
if: matrix.build == 'linux-static' | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --target ${{ matrix.target }} --release | ||
|
||
- name: Build archive | ||
shell: bash | ||
run: | | ||
if [ "${{ matrix.build }}" = "windows" ]; then | ||
echo "ASSET=target/${{ matrix.target }}/release/ntfs-undelete.exe" >> $GITHUB_ENV | ||
echo "ASSET_NAME=ntfs-undelete-${{ env.RELEASE_VERSION }}.exe" >> $GITHUB_ENV | ||
else | ||
echo "ASSET=target/${{ matrix.target }}/release/ntfs-undelete" >> $GITHUB_ENV | ||
echo "ASSET_NAME=ntfs-undelete-${{ env.RELEASE_VERSION }}-${{ matrix.target }}" >> $GITHUB_ENV | ||
fi | ||
- name: Upload release archive | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ env.RELEASE_UPLOAD_URL }} | ||
asset_path: ${{ env.ASSET }} | ||
asset_name: ${{ env.ASSET_NAME }} | ||
asset_content_type: application/octet-stream |
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
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