Skip to content

Commit

Permalink
chore: switch from set-output to GITHUB_OUTPUT
Browse files Browse the repository at this point in the history
  • Loading branch information
chuhlomin committed Oct 22, 2022
1 parent 0abed2b commit 9056e57
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Expand Up @@ -20,10 +20,10 @@ jobs:

- name: Get the tag
id: get_tag
run: echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//}
run: echo "tag=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT

- name: Tag & push image
run: |
docker pull ${{ env.DOCKER_IMAGE }}:${{ github.sha }}
docker tag ${{ env.DOCKER_IMAGE }}:${{ github.sha }} ${{ env.DOCKER_IMAGE }}:${{ steps.get_tag.outputs.TAG }}
docker push ${{ env.DOCKER_IMAGE }}:${{ steps.get_tag.outputs.TAG }}
docker tag ${{ env.DOCKER_IMAGE }}:${{ github.sha }} ${{ env.DOCKER_IMAGE }}:${{ steps.get_tag.outputs.tag }}
docker push ${{ env.DOCKER_IMAGE }}:${{ steps.get_tag.outputs.tag }}
10 changes: 9 additions & 1 deletion main.go
Expand Up @@ -56,7 +56,15 @@ func run() error {
return fmt.Errorf("failed to render template: %v", err)
}

fmt.Printf("::set-output name=result::%s", escape(output))
githubOutput := fmt.Sprintf("%s=%s", "result", escape(output))
if os.Getenv("GITHUB_OUTPUT") != "" {
githubOutput = fmt.Sprintln(os.Getenv("GITHUB_OUTPUT")) + githubOutput
}

err = os.Setenv("GITHUB_OUTPUT", githubOutput)
if err != nil {
return fmt.Errorf("failed to set GITHUB_OUTPUT: %v", err)
}

if len(c.ResultPath) != 0 {
err := ioutil.WriteFile(c.ResultPath, []byte(output), 0644)
Expand Down

0 comments on commit 9056e57

Please sign in to comment.