Skip to content

Commit

Permalink
build: 🛠 Add artifact publishing to releases
Browse files Browse the repository at this point in the history
  • Loading branch information
berkus committed Nov 12, 2024
1 parent dbfd79f commit c6d4f17
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 28 deletions.
48 changes: 20 additions & 28 deletions .github/workflows/outputs.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,28 @@
name: generate outputs
name: Generate Outputs for Review

permissions:
contents: read

on:
merge_group:
pull_request:
push:
branches:
- master
# on:
# push:
# paths:
# - '**.kicad_sch'
# - '**.kicad_pcb'
# pull_request:
# paths:
# - '**.kicad_sch'
# - '**.kicad_pcb'

jobs:
generate_outputs:
build:
name: Generate Outputs for Review
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: gitmarker
run: "for i in *.kicad_pcb; do git rev-parse --short HEAD | xargs -I % sed -i 's/{GITHASH}/%/g' $i; done" # add git marker
- uses: INTI-CMNB/KiBot@v2_k7
with:
# Required - kibot config file
config: config.kibot.yaml
# optional - prefix to output defined in config
dir: output
- name: upload results
uses: actions/upload-artifact@v3
with:
name: output
path: output
- uses: actions/checkout@v4
- name: gitmarker
run: "for i in *.kicad_pcb; do git rev-parse --short HEAD | xargs -I % sed -i 's/{GITHASH}/%/g' $i; done" # add git marker
- uses: INTI-CMNB/KiBot@v2_k7
with:
# Required - kibot config file
config: config.kibot.yaml
# optional - prefix to output defined in config
dir: output
- name: Upload temporary artifacts for review
uses: actions/upload-artifact@v4
with:
name: output
path: output
39 changes: 39 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Upload Pre-Release Asset

permissions:
contents: write

on:
push:
branches:
- master

jobs:
build:
name: Upload Pre-Release Asset
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set tag hash
id: tag
run: echo "hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: gitmarker
run: "for i in *.kicad_pcb; do sed -i 's/{GITHASH}/${{ steps.tag.outputs.hash }}/g' $i; done" # add git marker
- uses: INTI-CMNB/KiBot@v2_k7
with:
# Required - kibot config file
config: config.kibot.yaml
# optional - prefix to output defined in config
dir: output
- name: Release with Notes
uses: softprops/action-gh-release@v2
with:
body: Publish new snapshot of PCB @ ${{ github.sha }}
tag_name: preview-${{ steps.tag.outputs.hash }}
prerelease: true
fail_on_unmatched_files: true
files: |
output/**
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Upload Release Asset

permissions:
contents: write

on:
push:
tags:
- "v*"

jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set tag hash
id: tag
run: echo "hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: gitmarker
run: "for i in *.kicad_pcb; do sed -i 's/{GITHASH}/${{ steps.tag.outputs.hash }}/g' $i; done" # add git marker
- uses: INTI-CMNB/KiBot@v2_k7
with:
# Required - kibot config file
config: config.kibot.yaml
# optional - prefix to output defined in config
dir: output
- name: Release with Notes
uses: softprops/action-gh-release@v2
with:
body: Publish new version of PCB
tag_name: ${{ github.ref_name }}
prerelease: false
make_latest: true
fail_on_unmatched_files: true
files: |
output/**
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit c6d4f17

Please sign in to comment.