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-02 09:29:06 +08:00
|
|
|
outputs:
|
|
|
|
hash: ${{ steps.get-hash.outputs.hash }}
|
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
|
|
|
|
|
2023-08-02 09:43:08 +08:00
|
|
|
- run: corepack enable
|
|
|
|
|
2023-08-02 09:42:24 +08:00
|
|
|
- run: node -v
|
|
|
|
|
|
|
|
- run: yarn -v
|
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:
|
2023-08-02 00:21:40 +08:00
|
|
|
patterns: |
|
2023-08-02 09:57:11 +08:00
|
|
|
**/package.json
|
2023-08-02 00:21:40 +08:00
|
|
|
**/yarn.lock
|
2023-08-01 21:27:53 +08:00
|
|
|
|
2023-08-02 09:57:11 +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
|
|
|
|
|
2023-08-02 10:00:23 +08:00
|
|
|
- name: Cache node modules
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: node_modules
|
|
|
|
key: ${{ runner.os }}-yarn-${{ steps.get-hash.outputs.hash }}
|
|
|
|
|
2023-08-01 18:41:05 +08:00
|
|
|
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-02 09:42:24 +08:00
|
|
|
- name: Hash files
|
|
|
|
id: get-hash
|
|
|
|
uses: https://gitea.com/seepine/hash-files@v1
|
|
|
|
with:
|
|
|
|
patterns: |
|
2023-08-02 09:57:11 +08:00
|
|
|
**/package.json
|
2023-08-02 09:42:24 +08:00
|
|
|
**/yarn.lock
|
|
|
|
|
2023-08-02 09:57:11 +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-02 09:42:24 +08:00
|
|
|
key: ${{ runner.os }}-yarn-${{ steps.get-hash.outputs.hash }}
|
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
|
2023-08-02 09:35:18 +08:00
|
|
|
env:
|
|
|
|
- HASH: needs.setup.outputs.hash
|
2023-08-01 16:22:27 +08:00
|
|
|
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-02 09:47:44 +08:00
|
|
|
- run: node -v
|
|
|
|
|
|
|
|
- run: yarn -v
|
|
|
|
|
2023-08-02 09:42:24 +08:00
|
|
|
- name: Hash files
|
|
|
|
id: get-hash
|
|
|
|
uses: https://gitea.com/seepine/hash-files@v1
|
|
|
|
with:
|
|
|
|
patterns: |
|
2023-08-02 09:56:23 +08:00
|
|
|
**/package.json
|
2023-08-02 09:42:24 +08:00
|
|
|
**/yarn.lock
|
|
|
|
|
2023-08-02 09:35:18 +08:00
|
|
|
- run: echo "${{ env.HASH }}"
|
|
|
|
- run: echo "${{ workflows.setup.steps.get-hash.outputs.hash }}"
|
|
|
|
- run: echo "${{ workflows.setup.outputs.hash }}"
|
|
|
|
|
2023-08-02 09:23:13 +08:00
|
|
|
- run: echo "${{ needs.setup.steps.get-hash.outputs.hash }}"
|
2023-08-02 09:29:06 +08:00
|
|
|
- run: echo "${{ needs.setup.outputs.hash }}"
|
2023-08-02 09:23:13 +08:00
|
|
|
- run: echo "${{ steps.get-hash.outputs.hash }}"
|
|
|
|
- run: echo "${{ outputs.hash }}"
|
|
|
|
|
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-02 09:42:24 +08:00
|
|
|
key: ${{ runner.os }}-yarn-${{ steps.get-hash.outputs.hash }}
|
2023-08-01 20:51:02 +08:00
|
|
|
|
2023-08-01 21:11:02 +08:00
|
|
|
- name: Dependent installation
|
|
|
|
run: yarn install
|