generated from unoplat/base-project-structure
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (74 loc) · 2.78 KB
/
main-pr-merge-workflow.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
76
77
78
79
80
name: Go merge workflow
on:
pull_request:
types: [closed]
branches:
- main
jobs:
prepare_release:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release_action_plan.outputs.releases_created }}
paths_released: ${{ steps.release_action_plan.outputs.paths_released }}
all_outputs: ${{ steps.set_all_outputs.outputs.all_outputs }} # Rewritten this line
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 #
- name: Install jq
run: sudo apt-get install jq
- name: Release Please
id: release_action_plan
uses: google-github-actions/release-please-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
config-file: .github/configuration/release-please-config.json
manifest-file: .github/configuration/release-please-manifest.json
include-component-in-tag: true
- name: Set all outputs
id: set_all_outputs
uses: actions/github-script@v5
with:
script: |
const jsonOutputs = ${{toJson(steps.release_action_plan.outputs)}};
console.log('Outputs:', jsonOutputs);
core.setOutput('all_outputs', jsonOutputs);
build_and_release:
needs: prepare_release
if: needs.prepare_release.outputs.release_created == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [amd64, arm64]
tag: ${{ fromJson(needs.prepare_release.outputs.paths_released) }}
exclude:
- goarch: arm64
goos: windows
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: form tag name
id: set_path_name
run: echo "PATH_NAME=${{ matrix.tag }}--tag_name" >> $GITHUB_ENV
- name: Use github-script to access dynamic key
id: set_release_tag
uses: actions/github-script@v5
with:
script: |
const allOutputs = ${{ fromJson(needs.prepare_release.outputs.all_outputs) }};
const releaseTag = allOutputs['${{ steps.set_path_name.outputs.PATH_NAME }}'];
console.log('releaseTag',releaseTag)
core.setOutput('releaseTag', releaseTag);
# - name: Build and Release Go Binary
# uses: wangyoucao577/go-release-action@v1
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# goos: ${{ matrix.goos }}
# goarch: ${{ matrix.goarch }}
# goversion: "https://go.dev/dl/go1.22.0.linux-amd64.tar.gz"
# project_path: "image-action-gh/base-project/image-scan"
# binary_name: "image-scan"
# release_tag: ${{ steps.set_release_tag.outputs.releaseTag }}
# overwrite: true