Check Supported Go Versions #147
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check Supported Go Versions | |
on: | |
schedule: | |
- cron: "0 17 * * *" | |
workflow_dispatch: | |
inputs: | |
force_create_issue: | |
type: boolean | |
description: 'Create issue even if versions are up-to-date' | |
required: false | |
default: false | |
jobs: | |
check-go-eol: | |
if: github.repository == 'launchdarkly/ld-relay-private' | |
permissions: | |
issues: write | |
contents: read | |
runs-on: ubuntu-latest | |
timeout-minutes: 2 | |
steps: | |
- uses: actions/checkout@v1 | |
# 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@396ebea7d13904824f85b892b1616985f847301c | |
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 | |
run: | | |
echo "officialLatestVersion=${{ fromJSON(env.fetch-api-data)[0].latest }}" >> $GITHUB_ENV | |
echo "officialPenultimateVersion=${{ fromJSON(env.fetch-api-data)[1].latest }}" >> $GITHUB_ENV | |
# Read .circleci/config.yml to grab the version of Go used for release/testing, and the penultimate version | |
# which is also tested in CI. | |
- name: Parse latest supported Go version in Relay | |
id: relay-latest-version | |
uses: mikefarah/[email protected] | |
with: | |
cmd: yq '.parameters.go-release-version.default' .circleci/config.yml | |
- name: Parse penultimate supported Go version in Relay | |
id: relay-penultimate-version | |
uses: mikefarah/[email protected] | |
with: | |
cmd: yq '.parameters.go-previous-version.default' .circleci/config.yml | |
# If the latest official Go version is different from Relay's release version, generate an issue | |
# with useful details. | |
- name: Create issue if update required | |
if: github.event.inputs.force_create_issue || (steps.relay-latest-version.outputs.result != env.officialLatestVersion) | |
uses: JasonEtco/create-an-issue@e27dddc79c92bc6e4562f268fffa5ed752639abd | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
RELAY_LATEST_VERSION: ${{ steps.relay-latest-version.outputs.result }} | |
OFFICIAL_LATEST_VERSION: ${{ env.officialLatestVersion }} | |
RELAY_PENULTIMATE_VERSION: ${{ steps.relay-penultimate-version.outputs.result }} | |
OFFICIAL_PENULTIMATE_VERSION: ${{ env.officialPenultimateVersion }} | |
with: | |
filename: .github/ISSUE_TEMPLATE/update_go_versions.md | |
update_existing: true |