Skip to content

Commit

Permalink
Merge 2e85781 into 5d043a1
Browse files Browse the repository at this point in the history
  • Loading branch information
fiddlermikey authored Jan 6, 2024
2 parents 5d043a1 + 2e85781 commit 6d55d62
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/go-build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ jobs:
with:
# Allow goreleaser to access older tag information.
fetch-depth: 0
- name: Check file existence
id: check_files
uses: andstor/file-existence-action@v2
with:
files: "pkg/version/version.go" # Make this file a property in the manifest and input to the workflow
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
Expand All @@ -40,6 +45,10 @@ jobs:
echo "GO_ARGS=build --snapshot" | tee -a "$GITHUB_ENV"
echo "VERSION=0.0.0" | tee -a "$GITHUB_ENV" | tee -a "$GITHUB_STEP_SUMMARY"
fi
- name: Update version.go
if: github.event_name == 'pull_request' && steps.check_files.outputs.files_exists == 'true'
run: |
sed -i "s/const VERSION = .*/const VERSION = \"${{ inputs.release_version }}\"/" pkg/version/version.go
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
id: import_gpg
Expand Down
23 changes: 20 additions & 3 deletions .github/workflows/starter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,23 @@ jobs:
run: |
echo "primary_language=${{ steps.read.outputs.primary_language}}" | tee -a "$GITHUB_OUTPUT" | tee -a $GITHUB_STEP_SUMMARY
call-goreleaser-exists:
outputs:
goreleaser-exists: ${{ steps.check_files.outputs.files_exists }}
runs-on: ubuntu-latest
name: Check for .goreleaser file
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check file existence
id: check_files
uses: andstor/file-existence-action@v2
with:
files: ".goreleaser.y*ml"

call-create-github-release-workflow:
uses: Keyfactor/actions/.github/workflows/github-release.yml@v2

Expand All @@ -56,9 +73,9 @@ jobs:
token: ${{ secrets.token }}

call-go-build-and-release-workflow:
needs: [call-get-primary-language, call-assign-from-json-workflow, call-create-github-release-workflow]
if: needs.call-get-primary-language.outputs.primary_language == 'Go'
uses: keyfactor/actions/.github/workflows/go-build-and-release.yml@v2
needs: [call-get-primary-language, call-assign-from-json-workflow, call-create-github-release-workflow,call-goreleaser-exists]
if: needs.call-get-primary-language.outputs.primary_language == 'Go' && needs.call-goreleaser-exists.outputs.goreleaser-exists == 'true'
uses: keyfactor/actions/.github/workflows/go-build-and-release.yml@ab#53262-check-pkg-ver
with:
release_version: ${{ needs.call-create-github-release-workflow.outputs.release_version }}
secrets:
Expand Down

0 comments on commit 6d55d62

Please sign in to comment.