Skip to content

Commit

Permalink
Chore: release update workflow (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharmath authored Jun 20, 2023
1 parent 73d8189 commit f987cd4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 38 deletions.
28 changes: 8 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,23 +93,6 @@ jobs:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
run: flyctl deploy --remote-only ./target/docker/stage

draft:
name: Draft Release
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.10]
java: [temurin@8]
runs-on: ${{ matrix.os }}
permissions:
contents: write
pull-requests: write
steps:
- id: create_release
uses: release-drafter/release-drafter@v5
with:
config-name: release-drafter.yml

release:
name: Release
needs: [build]
Expand All @@ -130,16 +113,21 @@ jobs:
- name: Universal Stage
run: sbt Universal/stage

- id: create_release
uses: release-drafter/release-drafter@v5
with:
config-name: release-drafter.yml

- uses: TheDoctor0/zip-release@0.7.1
with:
type: zip
filename: tailcall-${{needs.draft.outputs.tag_name}}.zip
filename: tailcall-${{steps.create_release.outputs.name}}.zip
directory: target/universal/stage
exclusions: '*.git*, .metals'

- uses: softprops/action-gh-release@v1
with:
draft: true
append_body: true
tag_name: ${{needs.draft.outputs.tag_name}}
files: target/universal/stage/tailcall-${{needs.draft.outputs.tag_name}}.zip
tag_name: ${{steps.create_release.outputs.name}}
files: target/universal/stage/tailcall-${{steps.create_release.outputs.name}}.zip
26 changes: 8 additions & 18 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,10 @@ ThisBuild / githubWorkflowPermissions := Option(

ThisBuild / githubWorkflowAddedJobs ++= {
val githubWorkflowIsMain = Option("github.event_name == 'push' && github.ref == 'refs/heads/main'")
val draftJobId = "draft"
val createReleaseId = "create_release"

val tagName = List("needs", draftJobId, "outputs", "tag_name").mkString("${{", ".", "}}")

val fileName = "tailcall-" + tagName + ".zip"
val jobPermissions = sbtghactions.Permissions.Specify(Map(
val tagName = List("steps", createReleaseId, "outputs", "name").mkString("${{", ".", "}}")
val fileName = "tailcall-" + tagName + ".zip"
val jobPermissions = sbtghactions.Permissions.Specify(Map(
sbtghactions.PermissionScope.Contents -> sbtghactions.PermissionValue.Write,
sbtghactions.PermissionScope.PullRequests -> sbtghactions.PermissionValue.Write,
))
Expand All @@ -155,18 +152,6 @@ ThisBuild / githubWorkflowAddedJobs ++= {
javas = javaVersions,
),

// Update draft release
WorkflowJob(
draftJobId,
"Draft Release",
steps = List(WorkflowStep.Use(
id = Option(createReleaseId),
ref = UseRef.Public("release-drafter", "release-drafter", "v5"),
params = Map("config-name" -> "release-drafter.yml"),
)),
permissions = Option(jobPermissions),
),

// Release to Github
WorkflowJob(
id = "release",
Expand All @@ -179,6 +164,11 @@ ThisBuild / githubWorkflowAddedJobs ++= {
steps = List(
WorkflowStep.Checkout,
WorkflowStep.Sbt(commands = List("Universal/stage"), name = Option("Universal Stage")),
WorkflowStep.Use(
id = Option(createReleaseId),
ref = UseRef.Public("release-drafter", "release-drafter", "v5"),
params = Map("config-name" -> "release-drafter.yml"),
),
WorkflowStep.Use(
ref = UseRef.Public("TheDoctor0", "zip-release", "0.7.1"),
params = Map(
Expand Down

0 comments on commit f987cd4

Please sign in to comment.