Skip to content

Commit d303dfd

Browse files
add demo secert and needs config
Signed-off-by: souravbiswassanto <[email protected]>
1 parent 1894420 commit d303dfd

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,40 @@ on:
77
branches: [ "main" ]
88

99
jobs:
10-
11-
build:
10+
config:
11+
name: Configuration for ci
1212
runs-on: ubuntu-latest
13+
outputs:
14+
branch: ${{ steps.secret-name.outputs.demo_secret }}
15+
version: ${{ steps.go-version.outputs.version }}
1316
steps:
1417
- uses: actions/checkout@v4
18+
- name: demo secret
19+
id: secret-name
20+
env:
21+
demo_secret: ${{ secrets.MY_DEMO_SECRET }}
22+
run: echo "demo_secret=${demo_secret:-nothing}">>$GITHUB_OUTPUT
1523
- name: Extract Go Version
1624
id: go-version
1725
run: |
1826
GO_VERSION=$(grep '^go ' go.mod | awk '{ print $2}')
1927
echo "Extracted Go version: $GO_VERSION"
20-
echo "::set-output name=version::$GO_VERSION"
28+
echo "version=${GO_VERSION:-1.20}" >> $GITHUB_OUTPUT
2129
30+
build:
31+
runs-on: ubuntu-latest
32+
needs: config
33+
steps:
34+
- uses: actions/checkout@v4
2235
- name: Set up Go
2336
uses: actions/setup-go@v4
2437
with:
25-
go-version: ${{ steps.go-version.outputs.version }}
26-
38+
go-version: ${{ needs.config.outputs.version }}
39+
- name: Echo Secret
40+
env:
41+
demo_secret: ${{ needs.config.outputs.branch }}
42+
run: |
43+
echo "printing $demo_secret"
2744
- name: Build
2845
run: go build -v ./...
2946

0 commit comments

Comments
 (0)