23886a1c1c
Test Gitea Actions support Matrix? / build (12, ubuntu-latest) (push) Has been cancelled
Test Gitea Actions support Matrix? / build (14, ubuntu-latest) (push) Has been cancelled
Test Gitea Actions support Matrix? / build (16, ubuntu-latest) (push) Has been cancelled
Test Gitea Actions support Matrix? / build (18, ubuntu-latest) (push) Has been cancelled
Build Workflow / Build (push) Failing after 11s
Build Workflow / Deploy (push) Has been skipped
112 lines
3.7 KiB
YAML
112 lines
3.7 KiB
YAML
# .gitea/workflows/build.yaml
|
|
name: Build Workflow
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
#paths-ignore:
|
|
# - '.gitea/workflows/*'
|
|
|
|
jobs:
|
|
Build:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
# js-file: name of the output (choosen here)
|
|
# steps-js-filename -> The ID of the step which will produce a output (see Publish JS Filename Step)
|
|
# script-file -> The key name which contains the output (saved by the step - see Publish JS Filename Step)
|
|
js-file: ${{ steps.publish-js-filename.outputs.script-file }}
|
|
steps:
|
|
- name: Use Other (reuse.yml) Workflow
|
|
uses: ./.gitea/workflows/reuse.yml
|
|
- name: Error on purpose
|
|
id: failingstep
|
|
continue-on-error: true
|
|
run: exit 1
|
|
#- name: Continue with this step anyway
|
|
# if: ${{ failure() && steps.failingstep.conclusion == 'failure' }}
|
|
# run: echo "Still running... ${{toJSON(steps)}}"
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v3
|
|
- name: Install NodeJS
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '18'
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: '1.20'
|
|
- uses: actions/go-hashfiles@v0.0.1
|
|
id: get-cache-hash
|
|
with:
|
|
patterns: |-
|
|
**/package-lock.json
|
|
- name: Show key future key value
|
|
run: echo "deps-node-modules-${{ steps.get-cache-hash.outputs.hash }}"
|
|
- name: Setup Chache
|
|
uses: https://github.com/actions/cache@v3
|
|
with:
|
|
path: ~/.npm
|
|
key: deps-node-modules-${{ steps.get-cache-hash.outputs.hash }}
|
|
- name: Install Dependencies
|
|
run: npm ci
|
|
- name: Run Tests
|
|
run: npm test
|
|
- name: Build
|
|
run: npm run build
|
|
- name: Publish JS Filename
|
|
id: publish-js-filename
|
|
# Finds the desired Javascript file and prints a string 'script-file=<JS-FILENAME>' which then gets saved in the $GITHUB_OUTPUT file
|
|
run: find dist/assets/*.js -type f -execdir echo 'script-file={}' >> $GITHUB_OUTPUT ';'
|
|
- name: Package Artifacts
|
|
uses: https://github.com/thedoctor0/zip-release@0.7.1
|
|
with:
|
|
type: 'tar'
|
|
path: dist
|
|
filename: 'dist.tar.gz'
|
|
- name: Upload Artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: dist.tar.gz
|
|
path: dist.tar.gz
|
|
|
|
Deploy:
|
|
runs-on: ubuntu-latest
|
|
needs: Build
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: '1.20'
|
|
- uses: actions/go-hashfiles@v0.0.1
|
|
id: get-cache-hash
|
|
with:
|
|
patterns: |-
|
|
**/package-lock.json
|
|
- name: Show key future key value
|
|
run: echo "deps-node-modules-${{ steps.get-cache-hash.outputs.hash }}"
|
|
- name: Setup Chache
|
|
uses: https://github.com/actions/cache@v3
|
|
with:
|
|
path: ~/.npm
|
|
key: deps-node-modules-${{ steps.get-cache-hash.outputs.hash }}
|
|
- name: Access Artifacts
|
|
uses: https://github.com/actions/download-artifact@v3
|
|
with:
|
|
name: dist.tar.gz
|
|
- name: Output JS Filename from Build Job
|
|
# needs can access all previous jobs an their outputs if the current job is in their 'needs' chain
|
|
# js-file -> The output key defined in the Build job outputs area
|
|
run: echo "${{ needs.build.outputs.js-file }}"
|
|
- name: Deploy
|
|
run: |
|
|
echo Deploying...
|
|
ls
|
|
echo DONE!
|
|
#Notify-Commiter-Error:
|
|
# needs: Deploy
|
|
# runs-on: ubuntu-latest
|
|
# if: ${{ failure() }}
|
|
# steps:
|
|
# - name: Blame commiter
|
|
# run: echo "OMG YOU BROKE THE BUILD!!! FIX IT" |