Skip to content

Commit

Permalink
github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
sigmaSd committed Jun 19, 2020
1 parent f0524a3 commit 6fabc56
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 21 deletions.
101 changes: 101 additions & 0 deletions .github/workflows/rust.yml
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
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

0 comments on commit 6fabc56

Please sign in to comment.