1name: Dagger Release 2 3on: 4 workflow_dispatch: 5 inputs: 6 dagger_release_version: 7 description: 'The Dagger version to use in this release.' 8 required: true 9 10env: 11 USE_JAVA_DISTRIBUTION: 'zulu' 12 USE_JAVA_VERSION: '11' 13 # This is required by Gradle 8.0+. 14 USE_JAVA_VERSION_FOR_GRADLE_PLUGIN: '17' 15 # Required by JDK Toolchain Configuration 16 USE_JAVA_VERSION_FOR_GRADLE: '18' 17 DAGGER_RELEASE_VERSION: "${{ github.event.inputs.dagger_release_version }}" 18 # The default Maven 3.9.0 has a regression so we manually install 3.8.7. 19 # https://issues.apache.org/jira/browse/MNG-7679 20 USE_MAVEN_VERSION: '3.8.7' 21 22# TODO(bcorso):Convert these jobs into local composite actions to share with the 23# continuous integration workflow. 24jobs: 25 validate-latest-dagger-version: 26 name: 'Validate Dagger version' 27 runs-on: ubuntu-latest 28 steps: 29 - uses: actions/checkout@v4 30 - uses: ./.github/actions/prechecks 31 bazel-build: 32 name: 'Bazel build' 33 needs: validate-latest-dagger-version 34 runs-on: ubuntu-latest 35 steps: 36 - uses: actions/checkout@v4 37 - uses: ./.github/actions/bazel-build 38 bazel-test: 39 name: 'Bazel tests' 40 needs: validate-latest-dagger-version 41 runs-on: 42 group: large-runner-group 43 labels: ubuntu-22.04-16core 44 steps: 45 - uses: actions/checkout@v4 46 - uses: ./.github/actions/bazel-test 47 artifact-verification-tests: 48 name: 'Artifact verification tests' 49 needs: bazel-build 50 runs-on: ubuntu-latest 51 steps: 52 - uses: actions/checkout@v4 53 - uses: ./.github/actions/artifact-verification-tests 54 artifact-java-local-tests: 55 name: 'Artifact Java local tests' 56 needs: bazel-build 57 runs-on: ubuntu-latest 58 steps: 59 - uses: actions/checkout@v4 60 - uses: ./.github/actions/artifact-java-local-tests 61 test-gradle-plugin: 62 name: 'Test Hilt Gradle plugin' 63 needs: bazel-build 64 runs-on: ubuntu-latest 65 steps: 66 - uses: actions/checkout@v4 67 - uses: ./.github/actions/test-gradle-plugin 68 artifact-android-local-tests: 69 name: 'Artifact Android local tests (AGP ${{ matrix.agp }})' 70 needs: bazel-build 71 runs-on: ubuntu-latest 72 strategy: 73 matrix: 74 include: 75 - agp: '8.1.1' 76 jdk: '17' 77 steps: 78 - uses: actions/checkout@v4 79 - uses: ./.github/actions/artifact-android-local-tests 80 with: 81 agp: '${{ matrix.agp }}' 82 jdk: '${{ matrix.jdk }}' 83 publish-artifacts: 84 name: 'Publish Artifact' 85 needs: [ 86 bazel-test, 87 artifact-verification-tests, 88 artifact-java-local-tests, 89 artifact-android-local-tests, 90 test-gradle-plugin 91 ] 92 runs-on: ubuntu-latest 93 steps: 94 - name: 'Install Java ${{ env.USE_JAVA_VERSION }}' 95 uses: actions/setup-java@v4 96 with: 97 distribution: '${{ env.USE_JAVA_DISTRIBUTION }}' 98 java-version: '${{ env.USE_JAVA_VERSION }}' 99 server-id: sonatype-nexus-staging 100 server-username: CI_DEPLOY_USERNAME 101 server-password: CI_DEPLOY_PASSWORD 102 gpg-private-key: ${{ secrets.CI_GPG_PRIVATE_KEY }} 103 gpg-passphrase: CI_GPG_PASSPHRASE 104 - name: 'Check out repository' 105 uses: actions/checkout@v4 106 - name: 'Cache local Maven repository' 107 uses: actions/cache@v4 108 with: 109 path: | 110 ~/.m2/repository 111 !~/.m2/repository/com/google/dagger 112 key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} 113 restore-keys: | 114 ${{ runner.os }}-maven- 115 - name: 'Cache Bazel files' 116 uses: actions/cache@v4 117 with: 118 path: ~/.cache/bazel 119 key: ${{ runner.os }}-bazel-build-${{ github.sha }} 120 restore-keys: | 121 ${{ runner.os }}-bazel-build- 122 - name: 'Cache Gradle files' 123 uses: actions/cache@v4 124 with: 125 path: | 126 ~/.gradle/caches 127 ~/.gradle/wrapper 128 key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} 129 restore-keys: | 130 ${{ runner.os }}-gradle- 131 - name: Publish artifacts 132 run: | 133 util/deploy-all.sh \ 134 "gpg:sign-and-deploy-file" \ 135 "${{ env.DAGGER_RELEASE_VERSION }}" \ 136 "-DrepositoryId=sonatype-nexus-staging" \ 137 "-Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/" 138 shell: bash 139 env: 140 CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }} 141 CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }} 142 CI_GPG_PASSPHRASE: ${{ secrets.CI_GPG_PASSPHRASE }} 143 - name: 'Set git credentials' 144 run: | 145 git config --global user.email "dagger-dev+github@google.com" 146 git config --global user.name "Dagger Team" 147 shell: bash 148 - name: 'Publish tagged release' 149 run: util/publish-tagged-release.sh ${{ env.DAGGER_RELEASE_VERSION }} 150 shell: bash 151 - name: 'Publish tagged docs' 152 run: util/publish-tagged-docs.sh ${{ env.DAGGER_RELEASE_VERSION }} 153 shell: bash 154 env: 155 GH_TOKEN: ${{ github.token }} 156 - name: 'Clean bazel cache' 157 # According to the documentation, we should be able to exclude these via 158 # the actions/cache path, e.g. "!~/.cache/bazel/*/*/external/" but that 159 # doesn't seem to work. 160 run: | 161 rm -rf $(bazel info repository_cache) 162 rm -rf ~/.cache/bazel/*/*/external/ 163 shell: bash 164