Skip to content
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.

Commit

Permalink
Merge pull request #2 from mrisc32/feature/add_gh_actions
Browse files Browse the repository at this point in the history
CI: Add a GH action "Build Toolchain"
  • Loading branch information
mbitsnbites authored Nov 24, 2021
2 parents b3a71e1 + 4d1ea9d commit 3b344f5
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/build-toolchain.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
name: Build Toolchain

on:
push:
tags:
- v*
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive

- name: Build Toolchain
run: |
./build-in-docker.sh
mv out/install mrisc32-gnu-toolchain
tar -cvzf mrisc32-gnu-toolchain.tar.gz mrisc32-gnu-toolchain
- name: Upload
uses: actions/upload-artifact@v1
with:
path: mrisc32-gnu-toolchain.tar.gz
name: mrisc32-gnu-toolchain.tar.gz

release:
if: contains(github.ref, 'tags/v')
runs-on: ubuntu-20.04
needs: build

steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Store Release url
run: |
echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url
- uses: actions/upload-artifact@v1
with:
path: ./upload_url
name: upload_url

publish:
if: contains(github.ref, 'tags/v')
runs-on: ubuntu-20.04
needs: release

steps:
- name: Download artifact
uses: actions/download-artifact@v1
with:
name: mrisc32-gnu-toolchain.tar.gz
path: ./

- name: Download URL
uses: actions/download-artifact@v1
with:
name: upload_url
path: ./
- id: set_upload_url
run: |
upload_url=`cat ./upload_url`
echo ::set-output name=upload_url::$upload_url
- name: Upload to Release
id: upload_to_release
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.set_upload_url.outputs.upload_url }}
asset_path: mrisc32-gnu-toolchain.tar.gz
asset_name: mrisc32-gnu-toolchain.tar.gz
asset_content_type: application/x-tar

0 comments on commit 3b344f5

Please sign in to comment.