Skip to content

Commit 6df68cd

Browse files
committed
Add weekly releases in GitHub
This change adds automated weekly test releases that don't require to compile the code. An additional option is added to do manual releases. Fixes #275 Change-Id: If038652623f8a8e0528984c9ed53a97d2cfedd75
1 parent f653206 commit 6df68cd

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

.github/workflows/release.yaml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Weekly Release
2+
3+
on:
4+
# Uncoment these two lines to test the pipeline in a PR, but NEVER merge in main branch:
5+
# pull_request:
6+
# branches: [ "master" ]
7+
schedule:
8+
- cron: '0 11 * * 1' # Run every Monday at 7am NYC time
9+
branches:
10+
- master
11+
workflow_dispatch: # allows manual releasing
12+
branches:
13+
- master
14+
jobs:
15+
build_and_release:
16+
runs-on: ubuntu-latest
17+
# Uncomment for testing in PRs, but NEVER merge in main branch:
18+
#if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Bazel
25+
uses: actions/setup-java@v3
26+
with:
27+
distribution: 'adopt'
28+
java-version: '21'
29+
30+
- name: Build with Bazel
31+
run: bazel build java/com/google/copybara/copybara_deploy.jar
32+
33+
- name: Get current date
34+
id: date
35+
run: |
36+
echo "date=$(date +%Y%m%d)" >> $GITHUB_ENV
37+
38+
- name: Calculate SHA256 checksum
39+
id: checksum
40+
run: sha256sum bazel-bin/java/com/google/copybara/copybara_deploy.jar | awk '{print $1}' > copybara_deploy.jar.sha256
41+
42+
43+
- name: Create Release
44+
id: create_release
45+
uses: actions/create-release@v1
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
with:
49+
tag_name: v${{ steps.date.outputs.date }}
50+
release_name: Release v${{ env.date }}
51+
body: |
52+
Automated weekly test release snapshot from master branch.
53+
This is a test release, version compatibility or correctness
54+
not guaranteed.
55+
draft: true # change this to false once it works
56+
57+
- name: Upload Release Asset
58+
uses: actions/[email protected]
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
with:
62+
upload_url: ${{ steps.create_release.outputs.upload_url }}
63+
asset_path: bazel-bin/java/com/google/copybara/copybara_deploy.jar
64+
asset_name: copybara_deploy.jar
65+
asset_content_type: application/java-archive
66+
67+
- name: Upload Checksum File
68+
uses: actions/[email protected]
69+
env:
70+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
with:
72+
upload_url: ${{ steps.create_release.outputs.upload_url }}
73+
asset_path: copybara_deploy.jar.sha256
74+
asset_name: copybara_deploy.jar.sha256
75+
asset_content_type: text/plain

0 commit comments

Comments
 (0)