-
Notifications
You must be signed in to change notification settings - Fork 46
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
ci: add build-release
workflow and decouple Goreleaser
#1311
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,77 @@ | ||||||||||||||||||||||||||
name: build-release | ||||||||||||||||||||||||||
on: | ||||||||||||||||||||||||||
workflow_call: | ||||||||||||||||||||||||||
inputs: | ||||||||||||||||||||||||||
sha_short: | ||||||||||||||||||||||||||
type: string | ||||||||||||||||||||||||||
required: true | ||||||||||||||||||||||||||
new_tag: | ||||||||||||||||||||||||||
type: string | ||||||||||||||||||||||||||
required: true | ||||||||||||||||||||||||||
new_tag_short: | ||||||||||||||||||||||||||
type: string | ||||||||||||||||||||||||||
required: true | ||||||||||||||||||||||||||
name: | ||||||||||||||||||||||||||
type: string | ||||||||||||||||||||||||||
required: true | ||||||||||||||||||||||||||
sha: | ||||||||||||||||||||||||||
type: string | ||||||||||||||||||||||||||
required: true | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
jobs: | ||||||||||||||||||||||||||
server: | ||||||||||||||||||||||||||
name: Build and release server | ||||||||||||||||||||||||||
runs-on: ubuntu-latest | ||||||||||||||||||||||||||
if: inputs.name || inputs.new_tag | ||||||||||||||||||||||||||
env: | ||||||||||||||||||||||||||
ARTIFACTS: server/dist/reearth_*.* | ||||||||||||||||||||||||||
steps: | ||||||||||||||||||||||||||
- name: Checkout | ||||||||||||||||||||||||||
uses: actions/checkout@v3 | ||||||||||||||||||||||||||
with: | ||||||||||||||||||||||||||
fetch-depth: 0 | ||||||||||||||||||||||||||
- name: Set up Go | ||||||||||||||||||||||||||
uses: actions/setup-go@v4 | ||||||||||||||||||||||||||
with: | ||||||||||||||||||||||||||
go-version: "1.21" | ||||||||||||||||||||||||||
- name: Run GoReleaser | ||||||||||||||||||||||||||
uses: goreleaser/goreleaser-action@v4 | ||||||||||||||||||||||||||
with: | ||||||||||||||||||||||||||
distribution: goreleaser | ||||||||||||||||||||||||||
version: ~> v2 | ||||||||||||||||||||||||||
args: release --clean ${{ inputs.new_tag == '' && '--snapshot' || '' }} | ||||||||||||||||||||||||||
workdir: server | ||||||||||||||||||||||||||
env: | ||||||||||||||||||||||||||
GORELEASER_CURRENT_TAG: ${{ inputs.new_tag == '' && '0.0.0' || inputs.new_tag }} | ||||||||||||||||||||||||||
- name: Rename artifacts | ||||||||||||||||||||||||||
if: ${{ inputs.name != '' }} | ||||||||||||||||||||||||||
run: for f in $ARTIFACTS; do mv $f $(echo $f | sed -E 's/_0\.0\.0-SNAPSHOT-[^_]*/_${{ inputs.name }}/'); done | ||||||||||||||||||||||||||
- name: List artifacts | ||||||||||||||||||||||||||
Comment on lines
+47
to
+49
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. Fix shell script quoting issues The artifact renaming step has potential issues with word splitting and globbing. Apply this fix: - run: for f in $ARTIFACTS; do mv $f $(echo $f | sed -E 's/_0\.0\.0-SNAPSHOT-[^_]*/_${{ inputs.name }}/'); done
+ run: for f in "$ARTIFACTS"; do mv "$f" "$(echo "$f" | sed -E 's/_0\.0\.0-SNAPSHOT-[^_]*/_${{ inputs.name }}/')"; done 📝 Committable suggestion
Suggested change
🧰 Tools🪛 actionlint (1.7.4)48-48: shellcheck reported issue in this script: SC2086:info:1:28: Double quote to prevent globbing and word splitting (shellcheck) 48-48: shellcheck reported issue in this script: SC2046:warning:1:31: Quote this to prevent word splitting (shellcheck) 48-48: shellcheck reported issue in this script: SC2086:info:1:38: Double quote to prevent globbing and word splitting (shellcheck) |
||||||||||||||||||||||||||
run: ls -l server/dist | ||||||||||||||||||||||||||
- name: Release nightly/rc | ||||||||||||||||||||||||||
if: ${{ inputs.name != '' }} | ||||||||||||||||||||||||||
uses: ncipollo/release-action@v1 | ||||||||||||||||||||||||||
with: | ||||||||||||||||||||||||||
allowUpdates: true | ||||||||||||||||||||||||||
artifacts: ${{ env.ARTIFACTS }} | ||||||||||||||||||||||||||
commit: ${{ inputs.sha }} | ||||||||||||||||||||||||||
name: ${{ inputs.name }} | ||||||||||||||||||||||||||
tag: ${{ inputs.name }} | ||||||||||||||||||||||||||
body: ${{ inputs.sha_short }} | ||||||||||||||||||||||||||
prerelease: true | ||||||||||||||||||||||||||
- name: Download latest changelog | ||||||||||||||||||||||||||
if: ${{ inputs.new_tag != '' }} | ||||||||||||||||||||||||||
uses: dawidd6/action-download-artifact@v2 | ||||||||||||||||||||||||||
with: | ||||||||||||||||||||||||||
workflow: release.yml | ||||||||||||||||||||||||||
name: changelog-${{ inputs.new_tag }} | ||||||||||||||||||||||||||
- name: Create GitHub release | ||||||||||||||||||||||||||
Comment on lines
+63
to
+68
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. Update action-download-artifact to latest version The action for downloading artifacts is using an outdated version. Apply this version update: - uses: dawidd6/action-download-artifact@v2
+ uses: dawidd6/action-download-artifact@v3 📝 Committable suggestion
Suggested change
🧰 Tools🪛 actionlint (1.7.4)64-64: the runner of "dawidd6/action-download-artifact@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue (action) |
||||||||||||||||||||||||||
if: ${{ inputs.new_tag != '' }} | ||||||||||||||||||||||||||
uses: ncipollo/release-action@v1 | ||||||||||||||||||||||||||
with: | ||||||||||||||||||||||||||
allowUpdates: true | ||||||||||||||||||||||||||
artifacts: ${{ env.ARTIFACTS }} | ||||||||||||||||||||||||||
commit: ${{ inputs.sha }} | ||||||||||||||||||||||||||
name: ${{ inputs.new_tag }} | ||||||||||||||||||||||||||
tag: ${{ inputs.new_tag}} | ||||||||||||||||||||||||||
bodyFile: CHANGELOG_latest.md |
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.
Update GitHub Actions to their latest versions
Several actions are using outdated versions which may have security fixes or improvements in newer versions.
Apply these version updates:
📝 Committable suggestion
🧰 Tools
🪛 actionlint (1.7.4)
30-30: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
34-34: the runner of "actions/setup-go@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
38-38: the runner of "goreleaser/goreleaser-action@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)