Skip to content

Commit

Permalink
ci: Use GITHUB_OUTPUT envvar instead of set-output command
Browse files Browse the repository at this point in the history
`save-state` and `set-output` commands used in GitHub Actions are deprecated and [GitHub recommends using environment files](https://github.blog/changelog/2023-07-24-github-actions-update-on-save-state-and-set-output-commands/).

This PR updates the usage of `set-output` to `$GITHUB_OUTPUT`

Instructions for envvar usage from GitHub docs:

https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter
  • Loading branch information
arunsathiya authored Jan 18, 2024
1 parent 2af6d11 commit ef7dc01
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ jobs:
id: new-version
run: |
NEW_VERSION=$(yq e '.version' charts/gitops-server/Chart.yaml)
echo "::set-output name=version::$NEW_VERSION"
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
- name: Find old version
id: old-version
run: |
git checkout ${{ github.event.pull_request.base.sha || github.event.before }}
OLD_VERSION=$(yq e '.version' charts/gitops-server/Chart.yaml)
echo "::set-output name=version::$OLD_VERSION"
echo "version=$OLD_VERSION" >> $GITHUB_OUTPUT
helm-will-release:
runs-on: ubuntu-latest
Expand All @@ -59,7 +59,7 @@ jobs:
git log --exit-code $last_revision...${{ github.event.pull_request.base.sha }} charts/gitops-server
unreleased_commits=$?
if [[ $unreleased_commits == 1 ]]; then
echo "::set-output name=unreleased-commits::The last chart was last released in $last_revision and there have been other changes in the chart since"
echo "unreleased-commits=The last chart was last released in $last_revision and there have been other changes in the chart since" >> $GITHUB_OUTPUT
fi
- name: Let user know merging will cause a release
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
Expand All @@ -86,7 +86,7 @@ jobs:
id: new_version
run: |
NEW_VERSION=$(yq e '.version' charts/gitops-server/Chart.yaml)
echo "::set-output name=version::$NEW_VERSION"
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
- name: Generate new chart
run: |
URL=https://helm.gitops.weave.works
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
tag: ${{ steps.generate-tag.outputs.tag }}
steps:
- id: generate-tag
run: echo "::set-output name=tag::$(date -u +%s)-${{ github.sha }}"
run: echo "tag=$(date -u +%s)-${{ github.sha }}" >> $GITHUB_OUTPUT

ci-build-gitops-image:
name: CI Build Gitops Docker Image
Expand Down Expand Up @@ -195,7 +195,7 @@ jobs:
- id: gitsha
run: |
gitsha=$(git rev-parse --short ${{ github.sha }})
echo "::set-output name=sha::$gitsha"
echo "sha=$gitsha" >> $GITHUB_OUTPUT
- name: build
run: |
make gitops
Expand Down Expand Up @@ -239,7 +239,7 @@ jobs:
id: package-version
run: |
GITOPS_VERSION=$(git describe)
echo "::set-output name=js-version::$GITOPS_VERSION"
echo "js-version=$GITOPS_VERSION" >> $GITHUB_OUTPUT
jq '.version = "'$GITOPS_VERSION'" | .name = "@weaveworks/weave-gitops-main"' < dist/package.json > dist/package-new.json
mv dist/package-new.json dist/package.json
cp .npmrc dist
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
GITHUB_EVENT_PULL_REQUEST_HEAD_REF: ${{ github.event.pull_request.head.ref }}
run: |
version=$(echo $GITHUB_EVENT_PULL_REQUEST_HEAD_REF | cut -d'/' -f2)
echo "::set-output name=version::$version"
echo "version=$version" >> $GITHUB_OUTPUT
- name: Set tag
run: |
git config user.name weave-gitops-bot
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upgrade-flux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
new_version="$(curl -s --request GET --url "https://api.github.com/repos/fluxcd/flux2/releases?per_page=1" | jq . | jq '.[0] | .tag_name' | jq -r | sed -e 's/v//')"
if [[ "$old_version" != "$new_version" ]]; then
echo "::set-output name=version::$new_version"
echo "version=$new_version" >> $GITHUB_OUTPUT
fi
upgrade-flux:
needs:
Expand Down

0 comments on commit ef7dc01

Please sign in to comment.