Skip to content

Commit

Permalink
ci: Combine build workflows into one, and make tag workflow reuse bui…
Browse files Browse the repository at this point in the history
…ld workflow
  • Loading branch information
redmushie committed Sep 30, 2023
1 parent 21691bd commit 00bdf5a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ on:
push:
branches:
- master
- feature/captive-portal-ci
- develop
pull_request:
branches:
- master
- develop
types: [opened, reopened, synchronize]
workflow_call: # When another workflow invokes this one.
workflow_dispatch: # Manually invoked by user.

name: ci-master
name: ci-build

env:
NODE_VERSION: 16
Expand Down
44 changes: 8 additions & 36 deletions .github/workflows/ci-tag.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
on:
push:
branches:
- feature/captive-portal-ci
tags:
- 'v**'

Expand All @@ -11,44 +13,14 @@ env:

jobs:

# Copied verbatim from https://docs.platformio.org/en/stable/integration/ci/github-actions.html
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.platformio/platforms
~/.platformio/packages
~/.platformio/cache
key: ${{ runner.os }}-arch

- uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install PlatformIO Core
run: pip install --upgrade platformio

- name: Build PlatformIO Project
run: pio run

- name: Upload internal artifacts
uses: actions/upload-artifact@v3
with:
name: firmware.bin
path: .pio/build/ShockLink/firmware.bin
retention-days: 1

publish:
build-and-publish:
runs-on: ubuntu-latest
needs: build

steps:
- name: Build project
uses: ./.github/workflows/ci-build.yml

- name: Download release notes
uses: actions/checkout@v4
with:
Expand All @@ -58,7 +30,7 @@ jobs:
- name: Download internal artifacts
uses: actions/download-artifact@v3
with:
name: firmware.bin
name: merged-firmware.bin

# This step reads a file from repo and use it for body of the release
# This works on any self-hosted runner OS
Expand All @@ -76,7 +48,7 @@ jobs:
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: firmware.bin
file: merged-firmware.bin
asset_name: ShockLink.bin
tag: ${{ github.ref }}
body: |
Expand Down

0 comments on commit 00bdf5a

Please sign in to comment.