Skip to content

Commit

Permalink
[chore] Update Github action workflows to fix node version and set-ou…
Browse files Browse the repository at this point in the history
…tput deprecation warnings (#601)

* [chore] Update Github action workflows to fix node version and `set-output` deprecation warnings

* Trigger staging tests

* Trigger staging tests

* fix: Swap `checkout` and `setup-go` order to correctly load cache from `go.sum`
  • Loading branch information
jonathanedey committed Feb 7, 2024
1 parent 22deeba commit 1b8a162
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 36 deletions.
14 changes: 7 additions & 7 deletions .github/scripts/publish_preflight_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ if [[ ! "${RELEASE_VERSION}" =~ ^([0-9]*)\.([0-9]*)\.([0-9]*)$ ]]; then
fi

echo_info "Extracted release version: ${RELEASE_VERSION}"
echo "::set-output name=version::v${RELEASE_VERSION}"
echo "version=v${RELEASE_VERSION}" >> $GITHUB_OUTPUT


echo_info ""
Expand Down Expand Up @@ -108,13 +108,13 @@ readonly CHANGELOG=`${CURRENT_DIR}/generate_changelog.sh`
echo "$CHANGELOG"

# Parse and preformat the text to handle multi-line output.
# See https://github.community/t5/GitHub-Actions/set-output-Truncates-Multiline-Strings/td-p/37870
# See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#example-of-a-multiline-string
# and https://github.com/github/docs/issues/21529#issue-1418590935
FILTERED_CHANGELOG=`echo "$CHANGELOG" | grep -v "\\[INFO\\]"`
FILTERED_CHANGELOG="${FILTERED_CHANGELOG//'%'/'%25'}"
FILTERED_CHANGELOG="${FILTERED_CHANGELOG//$'\n'/'%0A'}"
FILTERED_CHANGELOG="${FILTERED_CHANGELOG//$'\r'/'%0D'}"
echo "::set-output name=changelog::${FILTERED_CHANGELOG}"

FILTERED_CHANGELOG="${FILTERED_CHANGELOG//$'\''/'"'}"
echo "changelog<<CHANGELOGEOF" >> $GITHUB_OUTPUT
echo -e "$FILTERED_CHANGELOG" >> $GITHUB_OUTPUT
echo "CHANGELOGEOF" >> $GITHUB_OUTPUT

echo ""
echo_info "--------------------------------------------"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ jobs:
go: [1.17, 1.18, 1.19]

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}

- name: Install golint
run: go install golang.org/x/lint/golint@latest

- name: Check out code
uses: actions/checkout@v2

- name: Run Linter
run: |
golint -set_exit_status ./...
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4
with:
ref: ${{ github.event.client_payload.ref || github.ref }}

- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.17

- name: Install golint
run: go install golang.org/x/lint/golint@latest

- name: Check out code
uses: actions/checkout@v2
with:
ref: ${{ github.event.client_payload.ref || github.ref }}

- name: Run Linter
run: |
golint -set_exit_status ./...
Expand Down
32 changes: 13 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ jobs:
# When manually triggering the build, the requester can specify a target branch or a tag
# via the 'ref' client parameter.
steps:
- name: Check out code
uses: actions/checkout@v4
with:
ref: ${{ github.event.client_payload.ref || github.ref }}

- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.17

- name: Install golint
run: go install golang.org/x/lint/golint@latest

- name: Check out code
uses: actions/checkout@v2
with:
ref: ${{ github.event.client_payload.ref || github.ref }}

- name: Run Linter
run: |
golint -set_exit_status ./...
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:

steps:
- name: Checkout source for publish
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
persist-credentials: false

Expand All @@ -89,7 +89,7 @@ jobs:

# We authorize this step with an access token that has write access to the master branch.
- name: Merge to master
uses: actions/github-script@0.9.0
uses: actions/github-script@v7
with:
github-token: ${{ secrets.FIREBASE_GITHUB_TOKEN }}
script: |
Expand All @@ -100,20 +100,14 @@ jobs:
head: 'dev'
})
# We pull this action from a custom fork of a contributor until
# https://github.com/actions/create-release/pull/32 is merged. Also note that v1 of
# this action does not support the "body" parameter.
# See: https://cli.github.com/manual/gh_release_create
- name: Create release tag
uses: fleskesvor/create-release@1a72e235c178bf2ae6c51a8ae36febc24568c5fe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.preflight.outputs.version }}
release_name: Firebase Admin Go SDK ${{ steps.preflight.outputs.version }}
body: ${{ steps.preflight.outputs.changelog }}
commitish: master
draft: false
prerelease: false
run: gh release create ${{ steps.preflight.outputs.version }}
--title "Firebase Admin Go SDK ${{ steps.preflight.outputs.version }}"
--notes '${{ steps.preflight.outputs.changelog }}'
--target "master"

# Post to Twitter if explicitly opted-in by adding the label 'release:tweet'.
- name: Post to Twitter
Expand Down

0 comments on commit 1b8a162

Please sign in to comment.