activate publish #1
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: Publish | |
on: | |
push: | |
tags: | |
- "*" | |
branches: | |
- master | |
pull_request: | |
jobs: | |
create-release: | |
runs-on: 'ubuntu-latest' | |
steps: | |
- name: Create Release | |
id: create-release | |
uses: actions/create-release@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
- shell: bash | |
run: | | |
echo '${{ steps.create-release.outputs.upload_url }}' > upload_url.txt | |
- name: Save GitHub release upload URL for next job | |
uses: actions/upload-artifact@master | |
with: | |
name: upload_url | |
path: upload_url.txt | |
create-assets: | |
needs: | |
- 'create-release' | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
target: | |
- x86_64-pc-windows-msvc | |
- i686-pc-windows-msvc | |
include: | |
- os: windows-latest | |
target: i686-pc-windows-msvc | |
asset_path: ./target/release/rust-experiemnts.exe | |
asset_name: rust-experiemnts-x86.exe | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
asset_path: ./target/release/rust-experiemnts.exe | |
asset_name: rust-experiemnts-x64.exe | |
steps: | |
- uses: actions/checkout@master | |
- name: Fetch GitHub Release upload URL | |
uses: actions/download-artifact@master | |
with: | |
name: upload_url | |
- name: Load Upload URL File from release job | |
id: get_release_info | |
run: | | |
echo "::set-output name=upload_url::$(cat upload_url/upload_url.txt)" | |
- uses: actions-rs/toolchain@master | |
with: | |
profile: minimal | |
toolchain: stable-${{ matrix.target }} | |
target: ${{ matrix.target }} | |
default: true | |
override: true | |
- uses: actions-rs/cargo@master | |
with: | |
command: build | |
args: --release | |
- uses: actions/upload-release-asset@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.get_release_info.outputs.upload_url }} | |
asset_path: ${{ matrix.asset_path }} | |
asset_name: ${{ matrix.asset_name }} | |
asset_content_type: application/octet-stream |