-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
101 additions
and
21 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,101 @@ | ||
name: release | ||
on: | ||
push: | ||
tags: | ||
- '[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.ELTRAFICO_VERSION == '' | ||
run: | | ||
echo "::set-env name=ELTRAFICO_VERSION::${GITHUB_REF#refs/tags/}" | ||
echo "version is: ${{ env.ELTRAFICO_VERSION }}" | ||
- name: Create GitHub release | ||
id: release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ env.ELTRAFICO_VERSION }} | ||
release_name: Release ${{ env.ELTRAFICO_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.ELTRAFICO_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: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
override: true | ||
target: x86_64-unknown-linux-musl | ||
|
||
- 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 "::set-env name=RELEASE_UPLOAD_URL::$release_upload_url" | ||
echo "release upload url: $RELEASE_UPLOAD_URL" | ||
- name: Donwload gtk dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libgtk-3-dev | ||
- name: Build release binary | ||
run: | | ||
cargo build --bins --release | ||
- name: Build archive | ||
shell: bash | ||
run: | | ||
mkdir "eltrafico" | ||
cp "target/release/eltrafico" "./eltrafico" | ||
cp "target/release/eltrafico_tc" "./eltrafico" | ||
tar czf "eltrafico.tar.gz" "eltrafico" | ||
echo "::set-env name=ASSET::eltrafico.tar.gz" | ||
- 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 }} | ||
asset_content_type: application/octet-stream |
This file was deleted.
Oops, something went wrong.