Skip to content

Commit

Permalink
Make Github workflow for creating a release (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
adincebic authored May 21, 2024
1 parent b8e8dfe commit 76f03d0
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 1 deletion.
39 changes: 39 additions & 0 deletions .github/generate-notes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

set -euo pipefail

readonly new_version=$1
readonly release_archive="bazel_sonarqube.$new_version.tar.gz"

sha=$(shasum -a 256 "$release_archive" | cut -d " " -f1)

cat <<EOF
## What's Changed
TODO
### MODULE.bazel Snippet
\`\`\`bzl
bazel_dep(name = "bazel_sonarqube", version = "$new_version", repo_name = "bazel_sonarqube")
\`\`\`
### Workspace Snippet
\`\`\`bzl
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "bazel_sonarqube",
sha256 = "$sha",
url = "https://github.com/Zetten/bazel-sonarqube/releases/download/$new_version/bazel_sonarqube.$new_version.tar.gz",
)
load(
"@bazel_sonarqube//:repositories.bzl",
"bazel_sonarqube_repositories"
)
bazel_sonarqube_repositories()
\`\`\`
EOF
26 changes: 26 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Create Release

on:
workflow_dispatch:
inputs:
tag:
description: 'The new version to tag, ex: 1.0.5'
required: true
type: string

jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create Release
run: |
set -euo pipefail
COPYFILE_DISABLE=1 tar czvf "bazel_sonarqube.$TAG.tar.gz" ./*
./.github/generate-notes.sh "$TAG" | tee notes.md
gh release create "$TAG" --title "$TAG" --target "$GITHUB_REF_NAME" --notes-file notes.md "bazel_sonarqube.$TAG.tar.gz"
env:
TAG: ${{ inputs.tag }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module(
name = "bazel_sonarqube",
version = "1.0.0",
version = "1.0.1",
compatibility_level = 1,
repo_name = "bazel_sonarqube",
)
Expand Down

0 comments on commit 76f03d0

Please sign in to comment.