-
Notifications
You must be signed in to change notification settings - Fork 1
chore: Adds release workflow and updates module name #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: 'New Release' | ||
run-name: 'Release ${{ inputs.version_number }} (use existing tag: ${{ inputs.use_existing_tag}})' | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version_number: | ||
description: 'Version number (e.g., v1.0.0, v1.0.0-pre, v1.0.0-pre1)' | ||
required: true | ||
use_existing_tag: | ||
description: 'Set value to `true` to use an existing tag for the release process, default is `false`' | ||
default: 'false' | ||
|
||
jobs: | ||
|
||
release-config: | ||
runs-on: ubuntu-latest | ||
permissions: {} | ||
outputs: | ||
creates_new_tag: ${{ steps.evaluate_inputs.outputs.creates_new_tag }} | ||
steps: | ||
- id: evaluate_inputs | ||
run: | | ||
{ | ||
echo "creates_new_tag=$(if [ '${{ inputs.use_existing_tag }}' = 'true' ]; then echo 'false'; else echo 'true'; fi)" | ||
} >> "$GITHUB_OUTPUT" | ||
|
||
validate-inputs: | ||
runs-on: ubuntu-latest | ||
permissions: {} | ||
steps: | ||
- name: Validation of version format | ||
run: | | ||
echo "${{ inputs.version_number }}" | grep -P '^v\d+\.\d+\.\d+(-pre[A-Za-z0-9-]*)?$' | ||
- name: Checkout | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | ||
with: | ||
ref: ${{ inputs.use_existing_tag == 'true' && inputs.version_number || 'main' }} | ||
|
||
create-tag: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
needs: [ release-config, validate-inputs ] | ||
if: >- | ||
!cancelled() | ||
&& !contains(needs.*.result, 'failure') | ||
&& needs.release-config.outputs.creates_new_tag == 'true' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | ||
with: | ||
ref: 'main' | ||
- name: Get the latest commit SHA | ||
id: get-sha | ||
run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" | ||
- name: Create release tag | ||
uses: rickstaa/action-create-tag@a1c7777fcb2fee4f19b0f283ba888afa11678b72 | ||
with: | ||
tag: ${{ inputs.version_number }} | ||
commit_sha: ${{ steps.get-sha.outputs.sha }} | ||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
gpg_passphrase: ${{ secrets.PASSPHRASE }} | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
needs: [ validate-inputs, create-tag ] | ||
if: >- | ||
!cancelled() | ||
&& !contains(needs.*.result, 'failure') | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | ||
with: | ||
ref: ${{ inputs.version_number }} | ||
- name: Set up Go | ||
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 | ||
with: | ||
go-version-file: 'go.mod' | ||
- name: Import GPG key | ||
id: import_gpg | ||
uses: crazy-max/ghaction-import-gpg@cb9bde2e2525e640591a934b1fd28eef1dcaf5e5 | ||
with: | ||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.PASSPHRASE }} | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 | ||
with: | ||
version: '~> v2' | ||
args: release --clean | ||
env: | ||
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# This is an example .goreleaser.yml file with some sensible defaults. | ||
# Make sure to check the documentation at https://goreleaser.com | ||
|
||
# The lines below are called `modelines`. See `:help modeline` | ||
# Feel free to remove those if you don't want/need to use them. | ||
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json | ||
# vim: set ts=2 sw=2 tw=0 fo=cnqoj | ||
|
||
version: 2 | ||
|
||
builds: | ||
- skip: true | ||
changelog: | ||
sort: asc | ||
use: github | ||
filters: | ||
exclude: | ||
- Merge pull request | ||
- Merge remote-tracking branch | ||
- Merge branch | ||
- go mod tidy | ||
groups: | ||
- title: "New Features" | ||
regexp: "^.*feat[(\\w)]*:+.*$" | ||
order: 0 | ||
- title: "Bug fixes" | ||
regexp: "^.*fix[(\\w)]*:+.*$" | ||
order: 10 | ||
- title: Other | ||
order: 999 | ||
|
||
checksum: | ||
name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS" | ||
algorithm: sha256 | ||
|
||
signs: | ||
- artifacts: checksum | ||
args: | ||
- "--batch" | ||
- "--local-user" | ||
- "{{ .Env.GPG_FINGERPRINT }}" | ||
- "--output" | ||
- "${signature}" | ||
- "--detach-sign" | ||
- "${artifact}" | ||
|
||
|
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,4 +1,4 @@ | ||
module go.mongodb.org/atlas-appservices | ||
module github.com/mongodb-labs/go-client-mongodb-atlas-app-services | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updating module name to match the repo for easy installation otherwise a vanity URL setup would be required |
||
go 1.23 | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can add prerelease param is you want to support pre-releases, e.g.: https://github.com/mongodb-labs/atlas-cli-plugin-terraform/blob/153a3877c13a52101879f7f32150107a5210d4fa/.goreleaser.yaml#L57
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's required at this point. Since this will eventually be deprecated and I don't see much use-cases for pre-releases as this client is quite light anyway