Skip to content
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

chore: fix release pipeline #8

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,44 @@ jobs:
go-version: "1.23"

- name: Validate version format
id: validate-version
run: |
if [[ ! ${{ github.event.inputs.version }} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid version format. Must be in format v1.0.0"
exit 1
fi

- name: Run tests
id: run-tests
if: steps.validate-version.outcome == 'success'
run: go test -v ./...

- name: Import GPG key
id: import-gpg-key
if: steps.run-tests.outcome == 'success'
run: |
echo "${{ secrets.MAGALUBOT_GPG_PRIVATE_KEY }}" | gpg --batch --yes --passphrase "${{ secrets.MAGALUBOT_GPG_PASSPHRASE }}" --import

- name: Create and push tag
- name: Config Git
id: config-git
if: steps.import-gpg-key.outcome == 'success'
run: |
git config --global user.email "${{vars.MAGALUBOT_EMAIL}}"
git config --global user.name "${{vars.MAGALUBOT_USER_NAME}}"
git config --global commit.gpgsign true
git config --global tag.gpgsign true
git config --global user.signingkey $(gpg --list-secret-keys --keyid-format LONG | grep sec | awk '{print $2}' | cut -d'/' -f2)

- name: Create and push tag
id: create-and-push-tag
if: steps.config-git.outcome == 'success'
run: |
git tag -a ${{ github.event.inputs.version }} -m "Release ${{ github.event.inputs.version }}"
git push origin ${{ github.event.inputs.version }}

- name: Publish to Go package registry
id: publish-to-go-package-registry
if: steps.create-and-push-tag.outcome == 'success'
env:
GOPROXY: proxy.golang.org
run: |
Expand Down
Loading