Files
actions-playground/.gitea/workflows/build.yml
T
tom.coursow 0c4e80646c
List Runner Tool Cache (Persistent) / check-tool-cache (push) Successful in 12s
Test Gitea Actions support Matrix? / build (16, ubuntu-latest) (push) Successful in 32s
Build Workflow / Build (push) Failing after 34s
Build Workflow / Deploy (push) Has been skipped
Test Gitea Actions support Matrix? / build (14, ubuntu-latest) (push) Successful in 34s
Test Gitea Actions support Matrix? / build (18, ubuntu-latest) (push) Successful in 28s
Output Information / info (push) Successful in 7s
.gitea/workflows/build.yml aktualisiert
2025-05-25 15:58:46 +02:00

115 lines
3.9 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:
# Reusing other Workflows does not work on Gitea yet (17.07.2023) So GitHub only for now.
#- name: Use Other (reuse.yml) Workflow
# uses: ./.gitea/workflows/reuse.yml
# with:
# person: ChatGPT
- 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.1'
- uses: https://gitea.com/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
id: cache-modules
uses: https://gitea.com/actions/cache@v3
with:
path: ~/.npm
key: deps-node-modules-${{ steps.get-cache-hash.outputs.hash }}
- name: Check Cache Hit
run: echo "Hit Cache - ${{ steps.cache-modules.outputs.cache-hit }}"
- 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: KEINOS/gh-action-hash-for-cache@v2.0.0-alpha
id: get-cache-hash
with:
path: |
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"