-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (63 loc) · 2.2 KB
/
build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Build
on:
push:
workflow_dispatch:
inputs:
upload_release_file:
type: boolean
default: false
description: Upload generated release file as an artifact.
release_version:
type: string
default: ""
required: true
description: Use this string as version in the application.
env:
TEST_REPO: kattecon/gh-app-access-token-gen-test
jobs:
check:
name: Build, lint and test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup nodejs
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: lts/*
- name: Build, lint and package if needed
run: |
if test -e Makefile; then
make build lint release-file
else
echo "Not building. It's supposed to be a release tag/branch then."
fi
- name: Generate token using app_id, pk and repo-name (1)
id: test_case_1_gen
uses: ./
with:
app_id: ${{ secrets.TEST_APP_ID }}
private_key: ${{ secrets.TEST_APP_PK }}
repository: ${{ env.TEST_REPO }}
- name: Test access using token from (1)
env:
GH_TOKEN: ${{ steps.test_case_1_gen.outputs.token }}
run: gh repo view "$TEST_REPO" --json name
- name: Generate token using app id, pk and installation id (2)
id: test_case_2_gen
uses: ./
with:
app_id: ${{ secrets.TEST_APP_ID }}
private_key: ${{ secrets.TEST_APP_PK }}
installation_id: ${{ secrets.TEST_APP_INST_ID }}
- name: Test access using token from (2)
env:
GH_TOKEN: ${{ steps.test_case_2_gen.outputs.token }}
run: gh repo view "$TEST_REPO" --json name
- name: Upload release artifact
if: "${{ github.event.inputs.upload_release_file == 'true' }}"
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: release
path: release.tar.gz