Update dependency types-PyYAML to v6.0.12.20240311 (#185) #277
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
name: Build | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
type: string | |
description: "Version Number" | |
push: | |
branches: | |
- main | |
concurrency: | |
group: build-${{ github.event.inputs.version || github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
metadata: | |
runs-on: ubuntu-latest | |
name: Metadata | |
outputs: | |
version: ${{ steps.version.outputs.VERSION }} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get Version | |
id: version | |
shell: bash | |
run: | | |
if [ -z "${INPUT_VERSION}" ]; then | |
echo ::set-output name=VERSION::$(git describe --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g') | |
else | |
echo ::set-output name=VERSION::${INPUT_VERSION} | |
fi | |
env: | |
INPUT_VERSION: ${{ github.event.inputs.version }} | |
- name: ${{ steps.version.outputs.VERSION }} | |
shell: bash | |
run: | | |
echo ${{ steps.version.outputs.VERSION }} | |
build-web: | |
runs-on: ubuntu-latest | |
name: "Build Web" | |
needs: | |
- metadata | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: "yarn" | |
cache-dependency-path: webapp/yarn.lock | |
- name: "Save version number" | |
run: echo "REACT_APP_BUILD_VERSION=${{ needs.metadata.outputs.version }}" > ./webapp/.env.production | |
- name: "Build Web" | |
run: cd webapp && yarn install && yarn build | |
- name: "Save artifact" | |
uses: actions/upload-artifact@v1 | |
with: | |
name: "web-${{ needs.metadata.outputs.version }}" | |
path: webapp/build | |
deploy: | |
runs-on: ubuntu-latest | |
name: Build & Publish ${{ matrix.arch }} / ${{ needs.metadata.outputs.version }} | |
if: github.event_name != 'pull_request' | |
needs: | |
- metadata | |
- build-web | |
permissions: | |
packages: write | |
strategy: | |
matrix: | |
arch: | |
- "aarch64" | |
- "amd64" | |
- "armhf" | |
- "armv7" | |
- "i386" | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
# - name: Login to Github Container Registry | |
# run: echo ${{ github.token }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin | |
- name: Login to DockerHub | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: "Get Web build" | |
uses: actions/download-artifact@v1 | |
with: | |
name: "web-${{ needs.metadata.outputs.version }}" | |
path: webapp/build | |
- name: ${{ matrix.arch }} / ${{ needs.metadata.outputs.version }} | |
uses: home-assistant/builder@master | |
with: | |
args: | | |
--${{ matrix.arch }} \ | |
--no-latest \ | |
--version ${{ needs.metadata.outputs.version }} \ | |
--target . | |
publish: | |
runs-on: ubuntu-latest | |
if: "${{ github.event.inputs.version != '' }}" | |
needs: | |
- metadata | |
- deploy | |
name: Create Github Pre-Release | |
permissions: | |
contents: write | |
steps: | |
- name: Pre-Release ${{ needs.metadata.outputs.version }} | |
uses: actions/github-script@v6 | |
env: | |
VERSION: ${{ needs.metadata.outputs.version }} | |
CHANGELOG: ${{ needs.metadata.outputs.changlelog }} | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.rest.repos.createRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag_name: process.env.VERSION, | |
prerelease: true, | |
}); |