77 lines
1.6 KiB
YAML
Raw Normal View History

2023-08-01 16:22:27 +08:00
name: Gitea Actions Demo
on: [push]
jobs:
2023-08-01 18:41:05 +08:00
2023-08-01 16:22:27 +08:00
setup:
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
2023-08-01 18:41:05 +08:00
env:
RUNNER_TOOL_CACHE: /toolcache
2023-08-01 16:22:27 +08:00
steps:
2023-08-01 18:44:09 +08:00
- name: Checkout
2023-08-01 16:22:27 +08:00
uses: actions/checkout@v3
with:
2023-08-01 18:41:05 +08:00
fetch-depth: 1
- run: corepack enable
2023-08-01 16:22:27 +08:00
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
2023-08-01 18:41:05 +08:00
cache: 'yarn'
2023-08-01 16:22:27 +08:00
2023-08-01 21:27:53 +08:00
- name: Hash files
id: get-hash
2023-08-01 23:53:55 +08:00
uses: https://gitea.com/seepine/hash-files@v1
2023-08-01 23:48:11 +08:00
with:
patterns: '**/yarn.lock'
2023-08-01 21:27:53 +08:00
2023-08-01 23:51:09 +08:00
- run: echo "${{ steps.get-hash.outputs.hash }}"
2023-08-01 23:49:27 +08:00
2023-08-01 23:51:09 +08:00
- run: echo "${{ runner.os }}"
2023-08-01 21:16:40 +08:00
2023-08-01 21:12:15 +08:00
- name: Cache node modules
uses: actions/cache@v3
2023-08-01 21:11:02 +08:00
with:
path: node_modules
2023-08-01 21:27:53 +08:00
key: ${{ runner.os }}-yarn-${{ steps.get-hash.outputs.hash }}
2023-08-01 21:11:02 +08:00
2023-08-01 18:41:05 +08:00
- name: Dependent installation
run: yarn install
test:
2023-08-01 16:22:27 +08:00
needs: setup
steps:
2023-08-01 21:11:02 +08:00
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
2023-08-01 18:41:05 +08:00
2023-08-01 21:12:15 +08:00
- name: Cache node modules
uses: actions/cache@v3
2023-08-01 20:51:02 +08:00
with:
2023-08-01 21:11:02 +08:00
path: node_modules
2023-08-01 21:14:18 +08:00
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
2023-08-01 20:51:02 +08:00
2023-08-01 21:11:02 +08:00
- name: Dependent installation
run: yarn install
2023-08-01 18:41:05 +08:00
build:
2023-08-01 16:22:27 +08:00
needs: setup
steps:
2023-08-01 21:12:15 +08:00
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
2023-08-01 18:41:05 +08:00
2023-08-01 21:12:15 +08:00
- name: Cache node modules
uses: actions/cache@v3
2023-08-01 20:51:02 +08:00
with:
2023-08-01 21:11:02 +08:00
path: node_modules
2023-08-01 21:14:18 +08:00
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
2023-08-01 20:51:02 +08:00
2023-08-01 21:11:02 +08:00
- name: Dependent installation
run: yarn install