-
Notifications
You must be signed in to change notification settings - Fork 2
80 lines (73 loc) · 3.4 KB
/
check-go-versions.yml
File metadata and controls
80 lines (73 loc) · 3.4 KB
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: Check Supported Go Versions
on:
schedule:
- cron: "0 17 * * *"
workflow_dispatch:
permissions: {}
jobs:
check-go-eol:
runs-on: ubuntu-slim
outputs:
latest: ${{ steps.parse.outputs.latest }}
penultimate: ${{ steps.parse.outputs.penultimate }}
timeout-minutes: 2
steps:
# Perform a GET request to endoflife.date for the Go language. The response
# contains all Go releases; we're interested in the 0'th and 1'th (latest and penultimate.)
- name: Fetch officially supported Go versions
uses: JamesIves/fetch-api-data-action@8dc51e982d982157bfd575ed64be3c48b3078037 # v2.5.0
with:
endpoint: https://endoflife.date/api/go.json
configuration: '{ "method": "GET" }'
debug: true
# Parse the response JSON and insert into environment variables for the next step.
- name: Parse officially supported Go versions
id: parse
run: |
echo "latest=${{ fromJSON(env.fetch-api-data)[0].cycle }}" >> $GITHUB_OUTPUT
echo "penultimate=${{ fromJSON(env.fetch-api-data)[1].cycle }}" >> $GITHUB_OUTPUT
create-prs:
permissions:
contents: read
id-token: write
needs: check-go-eol
runs-on: ubuntu-slim
env:
OFFICIAL_LATEST_VERSION: ${{ needs.check-go-eol.outputs.latest }}
OFFICIAL_PENULTIMATE_VERSION: ${{ needs.check-go-eol.outputs.penultimate }}
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Get current Go versions
id: go-versions
run: cat ./.github/variables/go-versions.env > $GITHUB_OUTPUT
- name: Update go-versions.env and README.md
if: steps.go-versions.outputs.latest != env.OFFICIAL_LATEST_VERSION
id: update-go-versions
run: |
sed -i -e "s#latest=[^ ]*#latest=${OFFICIAL_LATEST_VERSION}#g" \
-e "s#penultimate=[^ ]*#penultimate=${OFFICIAL_PENULTIMATE_VERSION}#g" \
./.github/variables/go-versions.env
- name: Create GitHub token
uses: launchdarkly/octosts-action@v1
if: steps.update-go-versions.outcome == 'success'
id: github-token
with:
scope: ${{ github.repository }}
identity: 'self.bump-go-versions'
- name: Create pull request
if: steps.update-go-versions.outcome == 'success'
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
with:
token: ${{ steps.github-token.outputs.token }}
add-paths: |
.github/variables/go-versions.env
branch: "launchdarklyreleasebot/update-to-go${{ env.OFFICIAL_LATEST_VERSION }}-${{ matrix.branch }}"
author: "LaunchDarklyReleaseBot <LaunchDarklyReleaseBot@launchdarkly.com>"
committer: "LaunchDarklyReleaseBot <LaunchDarklyReleaseBot@launchdarkly.com>"
labels: ${{ matrix.branch }}
title: "fix(deps): bump supported Go versions to ${{ env.OFFICIAL_LATEST_VERSION }} and ${{ env.OFFICIAL_PENULTIMATE_VERSION }}"
commit-message: "Bumps from Go ${{ steps.go-versions.outputs.latest }} -> ${{ env.OFFICIAL_LATEST_VERSION }} and ${{ steps.go-versions.outputs.penultimate }} -> ${{ env.OFFICIAL_PENULTIMATE_VERSION }}."
body: |
- [ ] I have triggered CI on this PR (either close & reopen this PR in Github UI, or `git commit -m "run ci" --allow-empty && git push`)