Skip to content

Commit

Permalink
Merge pull request #228 from negue/develop
Browse files Browse the repository at this point in the history
Merge: 2021.2.0
  • Loading branch information
negue committed Mar 2, 2021
2 parents 2ce77c1 + 3dd7888 commit da1dc8a
Show file tree
Hide file tree
Showing 234 changed files with 4,655 additions and 1,733 deletions.
248 changes: 248 additions & 0 deletions .github/workflows/build_and_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
# This is a basic workflow to help you get started with Actions

name: Build & Publish to Repo

on:
workflow_dispatch:
inputs:
nightly:
description: Is it a nightly build?
required: true
default: 'false'
tag-name:
description: Tag-Name
required: true
commitish:
description: Commit for the Release
required: true
release-name:
description: Release-Name
required: true
pre-release:
description: Pre-release ?
required: true
default: 'true'
draft:
description: Draft ?
required: true
default: 'false'

jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest

# Map a step output to a job output
outputs:
uploadURL: ${{ steps.create_release.outputs.upload_url }}

steps:
- run: echo ${{ github.event.inputs.commitish }}
- name: Checkout code
uses: actions/checkout@v2
- name: Cache multiple paths
uses: actions/cache@v2
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package.json') }}
- name: Use Node.js 12.16.2
uses: actions/setup-node@v1
with:
node-version: 12.16.2
- name: Declare some variables
id: vars
shell: bash
run: |
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Get current time
uses: gerred/actions/current-time@master
id: current-time
- name: Create version_info.json
uses: schdck/create-env-json@v1
id: create-env
with:
file-name: './src/version_info.json'
VERSION_TAG: ${{ github.event.inputs.tag-name }}
COMMIT: ${{ steps.vars.outputs.sha_short }}
BUILD_TIME: ${{ steps.current-time.outputs.time }}
BRANCH: ${{ steps.vars.outputs.branch }}

- name: Uploading Version Info Artifact
uses: actions/upload-artifact@v2
with:
name: version_info
path: './src/version_info.json'

- run: npm install
- run: npm run build:prepare
- run: npm run build:all

- name: Uploading Angular Dist Files
uses: actions/upload-artifact@v2
with:
name: angular-dist
path: dist

- run: npm run electron:build:only

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ github.event.inputs.nightly == 'true' && secrets.NIGHTLY_TOKEN || secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.tag-name }}
release_name: ${{ github.event.inputs.release-name }}
draft: ${{ github.event.inputs.draft }}
prerelease: ${{ github.event.inputs.pre-release }}
commitish: ${{ github.event.inputs.commitish }}
repo: ${{ github.event.inputs.nightly == 'true' && 'meme-box-nightly' || 'meme-box' }}

- name: Upload Release Asset Windows Headless
id: upload-release-asset-exe
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.event.inputs.nightly == 'true' && secrets.NIGHTLY_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: ./release/out/memebox.exe
asset_name: memebox-headless.exe
asset_content_type: application/vnd.microsoft.portable-executable

- name: Upload Release Asset Linux Headless
id: upload-release-asset-linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.event.inputs.nightly == 'true' && secrets.NIGHTLY_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: ./release/out/memebox-linux
asset_name: memebox-linux-headless
asset_content_type: application/octet-stream


- name: Upload Release Asset Mac Headless
id: upload-release-asset-mac
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.event.inputs.nightly == 'true' && secrets.NIGHTLY_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: ./release/out/memebox-macos
asset_name: memebox-macos-headless
asset_content_type: application/octet-stream

- name: Upload Release Asset Linux Electron
id: upload-release-asset-linux-electron
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.event.inputs.nightly == 'true' && secrets.NIGHTLY_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: ./release-electron/memebox-electron.AppImage
asset_name: memebox-electron.AppImage
asset_content_type: application/octet-stream

- name: Upload Streamdeck Plugin
id: upload-streamdeck-plugin
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.event.inputs.nightly == 'true' && secrets.NIGHTLY_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: ./memebox-streamdeck/Release/com.memebox.memebox-streamdeck.streamDeckPlugin
asset_name: com.memebox.memebox-streamdeck.streamDeckPlugin
asset_content_type: application/octet-stream

windows:
name: Build and Upload Windows Electron
needs: build

runs-on: windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache multiple paths
uses: actions/cache@v2
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package.json') }}
- name: Use Node.js 12.16.2
uses: actions/setup-node@v1
with:
node-version: 12.16.2

- run: npm install

- name: Download Angular Output from build
uses: actions/download-artifact@v2
with:
name: angular-dist
path: dist

- run: npm run electron:build:only

- name: Upload Release Asset Windows Electron
id: upload-release-asset-windows-electron
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.event.inputs.nightly == 'true' && secrets.NIGHTLY_TOKEN || secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.build.outputs.uploadURL }}
asset_path: ./release-electron/memebox-electron.exe
asset_name: memebox-windows-electron.exe
asset_content_type: application/octet-stream

- name: Upload Release Asset Windows Electron ZIP
id: upload-release-asset-windows-electron-zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.event.inputs.nightly == 'true' && secrets.NIGHTLY_TOKEN || secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.build.outputs.uploadURL }}
asset_path: ./release-electron/memebox-electron.zip
asset_name: memebox-windows-electron.zip
asset_content_type: application/zip

mac:
name: Build and Upload MacOS Electron
runs-on: macos-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache multiple paths
uses: actions/cache@v2
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package.json') }}
- name: Use Node.js 12.16.2
uses: actions/setup-node@v1
with:
node-version: 12.16.2

- run: npm install

- name: Download Angular Output from build
uses: actions/download-artifact@v2
with:
name: angular-dist
path: dist

- run: npm run electron:build:only

- name: Upload Release Asset Mac Electron
id: upload-release-asset-Mac-electron
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.event.inputs.nightly == 'true' && secrets.NIGHTLY_TOKEN || secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.build.outputs.uploadURL }} # 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: ./release-electron/memebox-electron.dmg
asset_name: memebox-mac-electron.dmg
asset_content_type: application/octet-stream
98 changes: 98 additions & 0 deletions .github/workflows/nightly_builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# This is a basic workflow to help you get started with Actions

name: Nightly build of develop

on:
schedule:
- cron: 0 4 * * *
workflow_dispatch:
inputs:

jobs:
check:
name: Check and Trigger the "Build/ Publish" Action
runs-on: ubuntu-latest

# Map a step output to a job output
outputs:
uploadURL: ${{ steps.create_release.outputs.upload_url }}

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: develop
# Create Tag by https://stackoverflow.com/a/64970393
- name: Checkout nightly build-repo # only in the nightly build trigger action
uses: actions/checkout@v2
with:
repository: negue/meme-box-nightly
path: nightly_repo
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo:
token: ${{ secrets.NIGHTLY_TOKEN }}

- name: get last commit # only in the nightly build trigger action
id: get-last-commit
uses: notiz-dev/github-action-json-property@release
with:
path: 'nightly_repo/last_commit.json'
prop_path: 'COMMIT'
- run: echo ${{steps.format_script.outputs.prop}}
- name: Get current date
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_ENV
- name: Declare some variables # needed ?
id: vars
shell: bash
run: |
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
echo "::set-output name=TAG_NAME::nightly${date}" # only in the nightly build trigger action
echo "::set-output name=RELEASE_NAME::nightly-release-${date}" # only in the nightly build trigger action
- name: Create last_commit.json
uses: schdck/create-env-json@v1
id: create-last-commit
if: ${{steps.get-last-commit.outputs.prop != steps.vars.outputs.sha_short }}
with:
file-name: './nightly_repo/last_commit.json'
VERSION_TAG: ${{ steps.vars.outputs.TAG_NAME }}
COMMIT: ${{ steps.vars.outputs.sha_short }}

- name: Create tag in public repository
if: ${{steps.get-last-commit.outputs.prop != steps.vars.outputs.sha_short }}
run: |
cd ${{github.workspace}}/nightly_repo
git tag ${{ steps.vars.outputs.TAG_NAME }}
- uses: stefanzweifel/git-auto-commit-action@v4
if: ${{steps.get-last-commit.outputs.prop != steps.vars.outputs.sha_short }}
with:
commit_message: Commit last_commit.json
repository: nightly_repo

- name: Push changes
uses: ad-m/github-push-action@master
if: ${{steps.get-last-commit.outputs.prop != steps.vars.outputs.sha_short }}
with:
github_token: ${{ secrets.NIGHTLY_TOKEN }}
branch: main
directory: nightly_repo
tags: true
repository: negue/meme-box-nightly

- name: Invoke workflow "build_and_publish" with inputs
uses: benc-uk/workflow-dispatch@v1
if: ${{steps.get-last-commit.outputs.prop != steps.vars.outputs.sha_short }}
with:
workflow: Build & Publish to Repo
token: ${{ secrets.NIGHTLY_TOKEN }}
ref: ${{ steps.vars.outputs.branch }}
inputs: |
{
"nightly": "true",
"tag-name": "${{ steps.vars.outputs.TAG_NAME }}",
"commitish": "main",
"release-name": "${{ steps.vars.outputs.RELEASE_NAME }}",
"pre-release": "true",
"draft": "false"
}
Loading

0 comments on commit da1dc8a

Please sign in to comment.