-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tech: update release and prerelease workflows
- Loading branch information
1 parent
84adeeb
commit e8a0a77
Showing
3 changed files
with
29 additions
and
28 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,21 +24,21 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Unshallow | ||
run: git fetch --prune --unshallow | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
uses: actions/setup-go@v5 | ||
with: | ||
cache: true | ||
go-version-file: 'go.mod' | ||
cache-dependency-path: go.sum | ||
|
||
- name: Configure Git | ||
env: | ||
TOKEN: ${{ secrets.HCP_SDK_PIPELINE_TOKEN }} | ||
TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
git config --global advice.detachedHead false | ||
git config --global url."https://${TOKEN}:[email protected]/".insteadOf "https://github.com/" | ||
|
@@ -85,19 +85,10 @@ jobs: | |
echo "New Version will be: $NEW_VERSION" | ||
echo "## Updating ${CURRENT_VERSION} to ${NEW_VERSION}" >> $GITHUB_STEP_SUMMARY | ||
echo "## Diff from Prerelease tasks" >> $GITHUB_STEP_SUMMARY | ||
echo "\`\`\`diff" >> $GITHUB_STEP_SUMMARY | ||
git diff @{upstream} @ >> $GITHUB_STEP_SUMMARY | ||
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | ||
echo "Diff from Prerelease tasks:" | ||
git diff @{upstream} @ | ||
- name: Release New Version | ||
if: success() && github.ref_name == 'main' && steps.changes.outputs.HAS_CHANGES == 'true' && ${{ !inputs.skip-release }} | ||
if: ${{ success() && github.ref_name == 'master' && steps.changes.outputs.HAS_CHANGES == 'true' && !inputs.skip-release }} | ||
run: | | ||
git tag -a ${NEW_VERSION} -m "New version ${NEW_VERSION}" | ||
echo "Git configuration:" | ||
git config -l | ||
echo "Pushing new tag to remote, which will trigger the Release workflow" | ||
git push --tags | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,44 @@ | ||
# This GitHub action can publish assets for release when a tag is created. | ||
name: release | ||
|
||
on: | ||
pull_request: | ||
push: | ||
# run only against tags | ||
tags: | ||
- 'v*' | ||
- "*" | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Unshallow | ||
run: git fetch --prune --unshallow | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
uses: actions/setup-go@v4 | ||
with: | ||
cache: true | ||
go-version-file: 'go.mod' | ||
cache-dependency-path: go.sum | ||
|
||
- name: Import GPG key | ||
id: import_gpg | ||
uses: paultyng/ghaction-import-gpg@v2.1.0 | ||
uses: crazy-max/ghaction-import-gpg@v6 | ||
env: | ||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | ||
PASSPHRASE: ${{ secrets.PASSPHRASE }} | ||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.PASSPHRASE }} | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
uses: goreleaser/goreleaser-action@v5 | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
args: release --clean | ||
env: | ||
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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