Implement automatic CDN publishing (#403)
This commit is contained in:
committed by
GitHub
parent
9ae3e48600
commit
569cce38fa
@@ -0,0 +1,24 @@
|
||||
name: Publish Firmware
|
||||
|
||||
inputs:
|
||||
cdn_version:
|
||||
description: The version that determines the path on the CDN
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: 'Download all-firmwares'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: 'all-firmwares'
|
||||
path: firmwares
|
||||
- name: 'Install boto3'
|
||||
shell: bash
|
||||
run: pip install boto3
|
||||
- name: 'Generate files'
|
||||
shell: bash
|
||||
run: version=`cat version.txt` && python Buildscripts/CDN/generate-files.py firmwares firmwares-cdn $version
|
||||
- name: 'Upload files'
|
||||
shell: bash
|
||||
run: python Buildscripts/CDN/upload-files.py firmwares-cdn ${{ inputs.cdn_version }} ${{ env.CDN_ID }} ${{ env.CDN_TOKEN_NAME }} ${{ env.CDN_TOKEN_VALUE }}
|
||||
@@ -3,6 +3,8 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- v*
|
||||
pull_request:
|
||||
types: [ opened, synchronize, reopened ]
|
||||
|
||||
@@ -57,8 +59,38 @@ jobs:
|
||||
Bundle:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ Build ]
|
||||
if: (github.event_name == 'pull_request' && startsWith(github.head_ref, 'release'))
|
||||
if: |
|
||||
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
|
||||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: "Bundle"
|
||||
uses: ./.github/actions/bundle-firmware
|
||||
PublishSnapshot:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ Bundle ]
|
||||
if: (github.event_name == 'push' && github.ref == 'refs/heads/main')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: "Publish Snapshot"
|
||||
env:
|
||||
CDN_ID: ${{ secrets.CDN_ID }}
|
||||
CDN_TOKEN_NAME: ${{ secrets.CDN_TOKEN_NAME }}
|
||||
CDN_TOKEN_VALUE: ${{ secrets.CDN_TOKEN_VALUE }}
|
||||
uses: ./.github/actions/publish-firmware
|
||||
with:
|
||||
cdn_version: snapshot
|
||||
PublishRelease:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ Bundle ]
|
||||
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: "Publish Stable"
|
||||
env:
|
||||
CDN_ID: ${{ secrets.CDN_ID }}
|
||||
CDN_TOKEN_NAME: ${{ secrets.CDN_TOKEN_NAME }}
|
||||
CDN_TOKEN_VALUE: ${{ secrets.CDN_TOKEN_VALUE }}
|
||||
uses: ./.github/actions/publish-firmware
|
||||
with:
|
||||
cdn_version: stable
|
||||
|
||||
Reference in New Issue
Block a user