fix: comments and test for release please action #74
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: Go merge workflow | |
on: | |
pull_request: | |
types: [closed] | |
branches: | |
- main | |
jobs: | |
prepare_release: | |
runs-on: ubuntu-latest | |
outputs: | |
release_created: ${{ steps.release_action_plan.outputs.releases_created }} | |
paths_released: ${{ steps.release_action_plan.outputs.paths_released }} | |
all_outputs: ${{ steps.set_all_outputs.outputs.all_outputs }} # Rewritten this line | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # | |
- name: Install jq | |
run: sudo apt-get install jq | |
- name: Release Please | |
id: release_action_plan | |
uses: google-github-actions/release-please-action@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
config-file: .github/configuration/release-please-config.json | |
manifest-file: .github/configuration/release-please-manifest.json | |
include-component-in-tag: true | |
- name: Set all outputs | |
id: set_all_outputs | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
const jsonOutputs = ${{toJson(steps.release_action_plan.outputs)}}; | |
console.log('Outputs:', jsonOutputs); | |
core.setOutput('all_outputs', jsonOutputs); | |
build_and_release: | |
needs: prepare_release | |
if: needs.prepare_release.outputs.release_created == 'true' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
goos: [linux, windows, darwin] | |
goarch: [amd64, arm64] | |
tag: ${{ fromJson(needs.prepare_release.outputs.paths_released) }} | |
exclude: | |
- goarch: arm64 | |
goos: windows | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: form tag name | |
id: set_path_name | |
run: echo "PATH_NAME=${{ matrix.tag }}--tag_name" >> $GITHUB_ENV | |
- name: Use github-script to access dynamic key | |
id: set_release_tag | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
const allOutputs = ${{ fromJson(needs.prepare_release.outputs.all_outputs) }}; | |
const releaseTag = allOutputs['${{ steps.set_path_name.outputs.PATH_NAME }}']; | |
console.log('releaseTag',releaseTag) | |
core.setOutput('releaseTag', releaseTag); | |
# - name: Build and Release Go Binary | |
# uses: wangyoucao577/go-release-action@v1 | |
# with: | |
# github_token: ${{ secrets.GITHUB_TOKEN }} | |
# goos: ${{ matrix.goos }} | |
# goarch: ${{ matrix.goarch }} | |
# goversion: "https://go.dev/dl/go1.22.0.linux-amd64.tar.gz" | |
# project_path: "image-action-gh/base-project/image-scan" | |
# binary_name: "image-scan" | |
# release_tag: ${{ steps.set_release_tag.outputs.releaseTag }} | |
# overwrite: true |