|
| 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: false # change this to true when testing |
| 56 | + |
| 57 | + - name: Upload Release Asset |
| 58 | + uses: actions/upload-release-asset@v1.0.2 |
| 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/upload-release-asset@v1.0.2 |
| 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