Skip to content

Commit b881dad

Browse files
committed
Add Build JAR action for Copybara (#1)
Update bazel test target to //... Create a GitHub Release with the JAR as an attachment Remove unnecessary keys from action-gh-release Use action-automatic-releases instead of action-gh-release Use short sha in filename of built JAR
1 parent 43703eb commit b881dad

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

.github/workflows/build_jar.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: "Build JAR"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_tag:
7+
description: 'Tag to create and release.'
8+
required: true
9+
default: 'latest'
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Setup Java JDK
17+
uses: actions/setup-java@v2.0.0
18+
with:
19+
distribution: 'adopt'
20+
java-version: '8'
21+
- name: Setup Bazelisk
22+
uses: bazelbuild/setup-bazelisk@v1.0.1
23+
- name: Mount bazel cache # Optional
24+
uses: actions/cache@v1
25+
with:
26+
path: "~/.cache/bazel"
27+
key: bazel
28+
- name: Build Copybara
29+
run: "bazel build //java/com/google/copybara:copybara_deploy.jar"
30+
- name: Test Copybara
31+
run: "bazel test //..."
32+
- name: Rename JAR
33+
run: "mv bazel-bin/java/com/google/copybara/copybara_deploy.jar copybara-${{ github.event.inputs.release_tag }}.jar"
34+
- name: Store built JAR
35+
uses: actions/upload-artifact@v2
36+
with:
37+
name: "copybara-${{ github.event.inputs.release_tag }}.jar"
38+
path: "copybara-${{ github.event.inputs.release_tag }}.jar"
39+
if-no-files-found: error
40+
- name: Automatic Releases
41+
uses: marvinpinto/action-automatic-releases@v1.2.0
42+
with:
43+
automatic_release_tag: "release-${{ github.event.inputs.release_tag }}"
44+
prerelease: false
45+
files: "copybara-${{ github.event.inputs.release_tag }}.jar"
46+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
47+

0 commit comments

Comments
 (0)