-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically create prelease releases on master builds (#453)
* Automatically create prerelease release on non-tagged master builds * Push tags first * For real now * yolo * Fix arm build location * trunk only
- Loading branch information
Showing
2 changed files
with
129 additions
and
1 deletion.
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,128 @@ | ||
name: Preview Release | ||
on: | ||
workflow_run: | ||
workflows: ["CI"] | ||
types: | ||
- completed | ||
push: | ||
# Run only on trunk pushes that aren't a new tag release | ||
branches: [trunk] | ||
tags-ignore: "*" | ||
|
||
env: | ||
BUNDLE_PATH: /tmp/.bundle | ||
GEM_HOME: /tmp/.bundle | ||
GEM_PATH: /tmp/.bundle | ||
TERM: xterm256 | ||
|
||
jobs: | ||
bump-tag: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-ecosystem/action-get-latest-tag@v1 | ||
id: get-latest-tag | ||
- uses: actions-ecosystem/action-bump-semver@v1 | ||
id: bump-semver | ||
with: | ||
current_version: ${{ steps.get-latest-tag.outputs.tag }} | ||
level: prepatch | ||
- uses: actions-ecosystem/action-push-tag@v1 | ||
with: | ||
tag: ${{ steps.bump-semver.outputs.new_version }} | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
needs: [bump-tag] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- os: ubuntu-20.04 | ||
target: native | ||
- os: macos-latest | ||
target: native | ||
- os: ubuntu-20.04 | ||
target: aarch64-unknown-linux-gnu | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
fetch-depth: 0 | ||
- if: runner.os == 'macOS' | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: 1.63.0 | ||
target: aarch64-apple-darwin | ||
default: true | ||
override: true | ||
profile: minimal | ||
- if: runner.os != 'macOS' | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: 1.63.0 | ||
override: true | ||
profile: minimal | ||
target: aarch64-unknown-linux-gnu | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
librubyfmt/ruby_checkout | ||
key: ${{ runner.os }}-${{matrix.target}}-ruby-v1-${{ hashFiles('.git/modules/librubyfmt/ruby_checkout/HEAD') }} | ||
- if: runner.os == 'macOS' | ||
run: | | ||
brew install automake bison | ||
echo "/usr/local/opt/bison/bin:$PATH" >> $GITHUB_PATH | ||
- run: ./script/make_release | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: rubyfmt-release-artifact-${{ matrix.os }}-${{ matrix.target }} | ||
path: rubyfmt-*.tar.gz | ||
source-release: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
fetch-depth: 0 | ||
- run: | | ||
TAG=$(git describe HEAD) | ||
RELEASE_DIR="out/release" | ||
mkdir -p ${RELEASE_DIR} | ||
./script/make_source_release ${TAG} | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: rubyfmt-source-release | ||
path: "out/release/source" | ||
release: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
- source-release | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-ecosystem/action-get-latest-tag@v1 | ||
id: get-latest-tag | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: rubyfmt-source-release | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: rubyfmt-release-artifact-ubuntu-20.04-aarch64-unknown-linux-gnu | ||
- run: | | ||
# The arch part of this path is set with uname, but we cross-compile the arm build on | ||
# an x86 machine, so we want to make sure the name is correct for the release | ||
mv rubyfmt-${{ steps.get-latest-tag.outputs.tag }}-Linux-x86_64.tar.gz rubyfmt-${{ steps.get-latest-tag.outputs.tag }}-Linux-aarch64.tar.gz | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: rubyfmt-release-artifact-ubuntu-20.04-native | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: rubyfmt-release-artifact-macos-latest-native | ||
- name: Upload Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: rubyfmt-*.tar.gz | ||
fail_on_unmatched_files: true | ||
generate_release_notes: true | ||
prerelease: true | ||
tag_name: ${{ steps.get-latest-tag.outputs.tag }} |
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