Release 2.0.105-b9 #751
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
on: | |
push: | |
branches: [main] | |
name: Create LedFx-Frontend Release | |
jobs: | |
build: | |
name: Build & Release | |
if: "startsWith(github.event.head_commit.message, 'Release') || startsWith(github.event.head_commit.message, 'Beta')" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20.x] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Get commit-messages | |
id: get_messages | |
run: | | |
git log --pretty=format:"+ %s [\![by](https://img.shields.io/badge/by-$(echo '%an' | sed 's/ /_/g')-blue.svg?logo=github&logoColor=white)](https://github.com/YeonV/LedFx-Frontend-v2/commit/%h)" $(git describe --tags --abbrev=0 @^)..@ | grep -v -E '(cleanup|Update)' | awk '{ sub(/\[\[!\]\]/, ""); msg = substr($0, 1, index($0, "[!") - 1); if (length(msg) >= 5 && !seen[msg]++) { print $0 } }' | awk '{ while (match($0, /https:\/\/img\.shields\.io\/badge\/by-[^"]*-blue\.svg\?logo=github&logoColor=white/)) { url = substr($0, RSTART, RLENGTH); gsub(" ", "_", url); printf "%s%s", substr($0, 1, RSTART - 1), url; $0 = substr($0, RSTART + RLENGTH) } gsub(" ", "_", $0); print }' >> /tmp/messages.txt | |
cp /tmp/messages.txt .messages.md | |
cat /tmp/messages.txt | |
echo 'MESSAGES<<EOF' >> $GITHUB_ENV | |
printf '%b\n' "$(cat /tmp/messages.txt)" >> $GITHUB_ENV | |
echo EOF >> $GITHUB_ENV | |
- name: get-npm-version | |
id: package-version | |
uses: martinbeentjes/npm-get-version-action@master | |
# - name: Dispatch Build | |
# run: | | |
# curl -XPOST -H "Accept: application/vnd.github.v3+json" -H "Authorization: token ${{secrets.FRONTEND_TOKEN}}" https://api.github.com/repos/YeonV/LedFx-Builds/actions/workflows/build-ledfx.yml/dispatches --data '{"fversion": "${{ steps.package-version.outputs.current-version}}"}' | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install Node Modules | |
run: | | |
yarn install | |
- name: Build project | |
env: | |
release_version: ${{ steps.package-version.outputs.current-version}} | |
REACT_APP_VERSION: ${{ steps.package-version.outputs.current-version}} | |
run: yarn build | |
- name: Preparing Archive | |
run: | | |
mv build ledfx_frontend_v2 | |
printf "${{ env.MESSAGES }}" >> ledfx_frontend_v2/messages.md | |
- name: Create Archive | |
uses: thedoctor0/zip-release@master | |
with: | |
filename: 'ledfx_frontend_v2.zip' | |
path: 'ledfx_frontend_v2' | |
exclusions: '*.git* /*node_modules/* .editorconfig' | |
- 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 }} | |
tag_name: ${{ steps.package-version.outputs.current-version}} | |
release_name: Release ${{ steps.package-version.outputs.current-version}} | |
body: | | |
${{ env.MESSAGES }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ./ledfx_frontend_v2.zip | |
asset_name: ledfx_frontend_v2.zip | |
asset_content_type: application/zip | |
- name: Prepare Trigger | |
id: get-id | |
run: | | |
id=$(echo ${{steps.package-version.outputs.current-version}} | cut -d. -f3) | |
echo "::set-output name=id::$id" | |
- name: Trigger Build | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: LedFx BuildPipeline New | |
# workflow: LedFx BuildPipeline | |
repo: YeonV/LedFx-Builds | |
token: ${{ secrets.FRONTEND_TOKEN }} | |
inputs: '{ "fversion": "${{ steps.get-id.outputs.id}}", "release": "${{ startsWith(github.event.head_commit.message, ''Beta'') && ''No'' || ''Yes'' }}" }' | |
# - name: 📂 Sync files | |
# continue-on-error: true | |
# uses: SamKirkland/[email protected] | |
# env: | |
# FTP_SERVER: ${{ secrets.FTP_SERVER }} | |
# FTP_USERNAME: ${{ secrets.FTP_USERNAME }} | |
# FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }} | |
# PORT: 22 | |
# METHOD: sftp | |
# LOCAL_DIR: ./ledfx_frontend_v2/ | |
# REMOTE_DIR: ./preview.ledfx.app/ | |
- name: Build project Hass | |
env: | |
release_version: ${{ steps.package-version.outputs.current-version}} | |
REACT_APP_VERSION: ${{ steps.package-version.outputs.current-version}} | |
run: yarn buildhass | |
- name: Preparing Archive | |
run: | | |
mv build ledfx_frontend_hass | |
printf "${{ env.MESSAGES }}" >> ledfx_frontend_hass/messages.md | |
- name: Create Archive | |
uses: thedoctor0/zip-release@master | |
with: | |
filename: 'ledfx_frontend_hass.zip' | |
path: 'ledfx_frontend_hass' | |
exclusions: '*.git* /*node_modules/* .editorconfig' | |
- name: Upload Release Asset Hass | |
id: upload-release-asset-hass | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ./ledfx_frontend_hass.zip | |
asset_name: ledfx_frontend_hass.zip | |
asset_content_type: application/zip | |
# - name: Prepare Trigger Hass | |
# id: hass | |
# run: | | |
# id=$(echo ${{steps.package-version.outputs.current-version}} | cut -d. -f1,2,3) | |
# echo "::set-output name=id::$id" | |
# - name: Trigger Hass | |
# uses: benc-uk/workflow-dispatch@v1 | |
# with: | |
# workflow: Builder | |
# repo: YeonV/home-assistant-addons | |
# ref: refs/heads/master | |
# token: ${{ secrets.LEDFX_HOMEASSISTANT_ADDON }} | |
# inputs: '{ "version": "${{ steps.hass.outputs.id}}" }' |