Skip to content

Commit 88c23ca

Browse files
committed
CI: add release workflow
1 parent 7f3dc70 commit 88c23ca

1 file changed

Lines changed: 119 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Build Release
2+
on:
3+
# pull_request:
4+
push:
5+
tags:
6+
- "**"
7+
8+
jobs:
9+
build:
10+
name: Build Release
11+
runs-on: ${{ matrix.os }}
12+
13+
strategy:
14+
fail-fast: true
15+
matrix:
16+
os:
17+
- macos-latest
18+
- ubuntu-latest
19+
20+
env:
21+
RUSTFLAGS: -D warnings
22+
RUST_BACKTRACE: full
23+
CARGO_INCREMENTAL: 0
24+
RUSTUP_MAX_RETRIES: 10
25+
CARGO_NET_RETRY: 10
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v2
30+
31+
- name: Install Rust toolchain
32+
uses: actions-rs/toolchain@v1
33+
with:
34+
toolchain: stable
35+
profile: minimal
36+
override: true
37+
38+
- if: matrix.os == 'ubuntu-latest'
39+
run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/
40+
41+
- name: Restore Cargo cache
42+
uses: actions/cache@v1
43+
with:
44+
path: ~/.cargo
45+
key: ${{ runner.os }}-cargo
46+
restore-keys: |
47+
${{ runner.os }}-cargo
48+
49+
- name: Build
50+
shell: bash
51+
run: cargo build --release -p move-lang --bin move-build
52+
53+
- name: Rename artifact
54+
shell: bash
55+
run: mv target/release/move-build movec-${{ runner.os }}
56+
57+
- name: Transfer artifact for next job
58+
uses: actions/upload-artifact@master
59+
with:
60+
name: movec-${{ runner.os }}
61+
path: movec-${{ runner.os }}
62+
63+
release:
64+
needs: build
65+
name: Upload Artifacts
66+
runs-on: ubuntu-latest
67+
steps:
68+
- name: Checkout repository
69+
uses: actions/checkout@v2
70+
71+
- name: Get macOS artifacts from Build Job
72+
uses: actions/download-artifact@v1
73+
with:
74+
name: movec-macOS
75+
path: artifacts/
76+
77+
- name: Get Linux artifacts from Build Job
78+
uses: actions/download-artifact@v1
79+
with:
80+
name: movec-Linux
81+
path: artifacts/
82+
83+
- name: Extract the version tag
84+
id: version_tag
85+
# or ${GITHUB_REF##*/}
86+
shell: bash
87+
run: echo ::set-output name=value::$(echo $GITHUB_REF | cut -d / -f 3)
88+
89+
- name: Create Release
90+
id: create_release
91+
uses: actions/create-release@v1
92+
env:
93+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
94+
with:
95+
tag_name: ${{ github.ref }}
96+
release_name: ${{ github.ref }}
97+
draft: true
98+
prerelease: true
99+
100+
- name: Upload Release (linux)
101+
uses: actions/upload-release-asset@v1
102+
env:
103+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104+
with:
105+
# This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include an `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
106+
upload_url: ${{ steps.create_release.outputs.upload_url }}
107+
asset_path: artifacts/movec-Linux
108+
asset_name: movec-${{ steps.version_tag.outputs.value }}-linux
109+
asset_content_type: application/octet-stream
110+
111+
- name: Upload Release (mac)
112+
uses: actions/upload-release-asset@v1
113+
env:
114+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
115+
with:
116+
upload_url: ${{ steps.create_release.outputs.upload_url }}
117+
asset_path: artifacts/movec-macOS
118+
asset_name: movec-${{ steps.version_tag.outputs.value }}-darwin
119+
asset_content_type: application/octet-stream

0 commit comments

Comments
 (0)