|
7 | 7 | - 'v*'
|
8 | 8 |
|
9 | 9 | jobs:
|
10 |
| - # TODO(https://github.com/AcademySoftwareFoundation/OpenCue/issues/715) Add another job to |
11 |
| - # release the Docker images. |
| 10 | + preflight: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + name: Preflight |
| 13 | + steps: |
| 14 | + - name: Checkout code |
| 15 | + uses: actions/checkout@v2 |
| 16 | + with: |
| 17 | + fetch-depth: 0 |
| 18 | + |
| 19 | + - name: Set build ID |
| 20 | + run: | |
| 21 | + set -e |
| 22 | + ci/generate_version_number.sh > VERSION |
| 23 | + echo "Build ID: $(cat ./VERSION)" |
| 24 | + echo "::set-env name=BUILD_ID::$(cat ./VERSION)" |
| 25 | +
|
| 26 | + - name: Get current tag name |
| 27 | + run: echo ::set-env name=TAG_NAME::${GITHUB_REF/refs\/tags\//} |
| 28 | + |
| 29 | + - name: Verify tag name and version match |
| 30 | + run: | |
| 31 | + set -e |
| 32 | + if [ "v$(cat VERSION)" != "${TAG_NAME}" ]; then |
| 33 | + echo "Version check failed: code version v$(cat VERSION) does not match tag name ${TAG_NAME}" |
| 34 | + echo "Original GITHUB_REF: ${GITHUB_REF}" |
| 35 | + exit 1 |
| 36 | + fi |
| 37 | +
|
| 38 | + release_docker_images: |
| 39 | + needs: preflight |
| 40 | + runs-on: ubuntu-latest |
| 41 | + strategy: |
| 42 | + matrix: |
| 43 | + component: [cuebot, rqd, pycue, pyoutline, cuegui, cuesubmit, cueadmin] |
| 44 | + |
| 45 | + name: Release ${{ matrix.component }} Docker image |
| 46 | + steps: |
| 47 | + - name: Checkout code |
| 48 | + uses: actions/checkout@v2 |
| 49 | + with: |
| 50 | + fetch-depth: 0 |
| 51 | + |
| 52 | + - name: Set build ID |
| 53 | + run: | |
| 54 | + set -e |
| 55 | + ci/generate_version_number.sh > VERSION |
| 56 | + echo "Build ID: $(cat ./VERSION)" |
| 57 | + echo "::set-env name=BUILD_ID::$(cat ./VERSION)" |
| 58 | +
|
| 59 | + - name: Pull Docker image from staging |
| 60 | + run: | |
| 61 | + set -e |
| 62 | + docker pull opencuebuild/${{ matrix.component }}:${BUILD_ID} |
| 63 | +
|
| 64 | + - name: Rebuild and push Docker image |
| 65 | + uses: docker/build-push-action@v1 |
| 66 | + with: |
| 67 | + username: ${{ secrets.DOCKER_USER }} |
| 68 | + password: ${{ secrets.DOCKER_PASS }} |
| 69 | + dockerfile: ${{ matrix.component }}/Dockerfile |
| 70 | + repository: opencue/${{ matrix.component }} |
| 71 | + tags: ${{ env.BUILD_ID }}, latest |
| 72 | + |
12 | 73 | create_release:
|
| 74 | + needs: preflight |
13 | 75 | name: Create Release
|
14 | 76 | runs-on: ubuntu-latest
|
15 | 77 | steps:
|
16 | 78 | - name: Checkout code
|
17 | 79 | uses: actions/checkout@v2
|
18 | 80 | with:
|
19 | 81 | fetch-depth: 0
|
| 82 | + |
| 83 | + - name: Configure AWS credentials |
| 84 | + uses: aws-actions/configure-aws-credentials@v1 |
| 85 | + with: |
| 86 | + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 87 | + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 88 | + aws-region: ${{ secrets.S3_REGION }} |
| 89 | + role-to-assume: ${{ secrets.AWS_S3_ROLE }} |
| 90 | + role-duration-seconds: 1800 |
| 91 | + |
| 92 | + - name: Set build ID |
| 93 | + run: | |
| 94 | + set -e |
| 95 | + ci/generate_version_number.sh > VERSION |
| 96 | + echo "Build ID: $(cat ./VERSION)" |
| 97 | + echo "::set-env name=BUILD_ID::$(cat ./VERSION)" |
| 98 | +
|
20 | 99 | - name: Fetch artifacts
|
| 100 | + id: fetch_artifacts |
21 | 101 | env:
|
22 |
| - PACKAGING_WORKFLOW_ID: 1539149 |
23 |
| - # Fetching artifacts from another pipeline, or even a different run of the same pipeline, |
24 |
| - # is currently not well-supported in Github Actions. We must use the Github REST API to |
25 |
| - # search for the correct workflow by commit SHA, then we can attempt to download the |
26 |
| - # artifacts from that workflow run. |
| 102 | + S3_BUCKET: ${{ secrets.S3_BUCKET }} |
27 | 103 | run: |
|
28 |
| - set -e |
29 |
| - echo "SHA: ${{ github.sha }}" |
30 |
| - run_id=$(curl -s https://api.github.com/repos/${{ github.repository }}/actions/runs \ |
31 |
| - | jq ".workflow_runs[] | select(.head_sha == \"${{ github.sha }}\" and .workflow_id==${PACKAGING_WORKFLOW_ID}).id") |
32 |
| - echo "Packaging pipeline run ID: ${run_id}" |
33 |
| - artifact_ids=$(curl -s https://api.github.com/repos/${{ github.repository }}/actions/runs/${run_id}/artifacts \ |
34 |
| - | jq '.artifacts[].id') |
35 |
| - echo "Artifact IDs: ${artifact_ids}" |
36 |
| - for artifact_id in ${artifact_ids}; do |
37 |
| - api_path="repos/${{ github.repository }}/actions/artifacts/${artifact_id}/zip" |
38 |
| - echo "Fetching artifact ${artifact_id} at https://api.github.com/${api_path}" |
39 |
| - curl -L -O "https://${{ secrets.GITHUB_TOKEN }}@api.github.com/${api_path}" |
40 |
| - done |
| 104 | + mkdir -p "${GITHUB_WORKSPACE}/artifacts/" |
| 105 | + aws s3 sync "s3://${S3_BUCKET}/opencue/${BUILD_ID}/" "${GITHUB_WORKSPACE}/artifacts/" |
| 106 | + echo "::set-output name=filenames::$(ls "${GITHUB_WORKSPACE}/artifacts/" | xargs)" |
| 107 | +
|
| 108 | + - name: List artifacts |
| 109 | + run: | |
| 110 | + echo ${{ steps.fetch_artifacts.outputs.filenames }} |
| 111 | +
|
41 | 112 | - name: Generate release notes
|
42 | 113 | id: release_notes
|
43 | 114 | run: |
|
44 | 115 | last_tagged_version=$(git describe --tags $(git rev-list --tags --max-count=1))
|
45 | 116 | commits_since_last_release=$(git log --pretty="* %H %s" ${last_tagged_version}..HEAD)
|
| 117 | + # See https://github.community/t/set-output-truncates-multiline-strings/16852 |
| 118 | + commits_since_last_release="${commits_since_last_release//$'\n'/'%0A'}" |
46 | 119 | echo "::set-output name=commits::${commits_since_last_release}"
|
| 120 | +
|
47 | 121 | - name: Create release
|
| 122 | + id: create_release |
48 | 123 | uses: actions/create-release@v1
|
49 | 124 | env:
|
50 | 125 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
51 | 126 | with:
|
52 |
| - tag_name: ${{ github.ref }} |
53 |
| - release_name: Release ${{ github.ref }} |
| 127 | + tag_name: v${{ env.BUILD_ID }} |
| 128 | + release_name: v${{ env.BUILD_ID }} |
54 | 129 | body: |
|
55 |
| - To learn how to install and configure OpenCue, see our |
56 |
| - [Getting Started guide](https://www.opencue.io/docs/getting-started/). |
| 130 | + To learn how to install and configure OpenCue, see our [Getting Started guide](https://www.opencue.io/docs/getting-started/). |
57 | 131 |
|
58 | 132 | ## Changes:
|
59 | 133 |
|
60 | 134 | ${{ steps.release_notes.outputs.commits }}
|
61 | 135 | draft: true
|
62 | 136 | prerelease: false
|
| 137 | + |
| 138 | + - name: Upload License |
| 139 | + uses: actions/upload-release-asset@v1 |
| 140 | + env: |
| 141 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 142 | + with: |
| 143 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 144 | + asset_path: ${{ github.workspace }}/artifacts/LICENSE |
| 145 | + asset_name: LICENSE |
| 146 | + asset_content_type: application/octet-stream |
| 147 | + |
| 148 | + - name: Upload Database Schema |
| 149 | + uses: actions/upload-release-asset@v1 |
| 150 | + env: |
| 151 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 152 | + with: |
| 153 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 154 | + asset_path: ${{ github.workspace }}/artifacts/schema-${{ env.BUILD_ID }}.sql |
| 155 | + asset_name: schema-${{ env.BUILD_ID }}.sql |
| 156 | + asset_content_type: application/octet-stream |
| 157 | + |
| 158 | + - name: Upload Demo Data |
| 159 | + uses: actions/upload-release-asset@v1 |
| 160 | + env: |
| 161 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 162 | + with: |
| 163 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 164 | + asset_path: ${{ github.workspace }}/artifacts/demo_data-${{ env.BUILD_ID }}.sql |
| 165 | + asset_name: demo_data-${{ env.BUILD_ID }}.sql |
| 166 | + asset_content_type: application/octet-stream |
| 167 | + |
| 168 | + - name: Upload Cuebot JAR |
| 169 | + uses: actions/upload-release-asset@v1 |
| 170 | + env: |
| 171 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 172 | + with: |
| 173 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 174 | + asset_path: ${{ github.workspace }}/artifacts/cuebot-${{ env.BUILD_ID }}-all.jar |
| 175 | + asset_name: cuebot-${{ env.BUILD_ID }}-all.jar |
| 176 | + asset_content_type: application/octet-stream |
| 177 | + |
| 178 | + - name: Upload Cuebot RPM |
| 179 | + uses: actions/upload-release-asset@v1 |
| 180 | + env: |
| 181 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 182 | + with: |
| 183 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 184 | + asset_path: ${{ github.workspace }}/artifacts/opencue-cuebot-${{ env.BUILD_ID }}-1.noarch.rpm |
| 185 | + asset_name: opencue-cuebot-${{ env.BUILD_ID }}-1.noarch.rpm |
| 186 | + asset_content_type: application/octet-stream |
| 187 | + |
| 188 | + - name: Upload RQD Tar |
| 189 | + uses: actions/upload-release-asset@v1 |
| 190 | + env: |
| 191 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 192 | + with: |
| 193 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 194 | + asset_path: ${{ github.workspace }}/artifacts/rqd-${{ env.BUILD_ID }}-all.tar.gz |
| 195 | + asset_name: rqd-${{ env.BUILD_ID }}-all.tar.gz |
| 196 | + asset_content_type: application/octet-stream |
| 197 | + |
| 198 | + - name: Upload CueGUI Tar |
| 199 | + uses: actions/upload-release-asset@v1 |
| 200 | + env: |
| 201 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 202 | + with: |
| 203 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 204 | + asset_path: ${{ github.workspace }}/artifacts/cuegui-${{ env.BUILD_ID }}-all.tar.gz |
| 205 | + asset_name: cuegui-${{ env.BUILD_ID }}-all.tar.gz |
| 206 | + asset_content_type: application/octet-stream |
| 207 | + |
| 208 | + - name: Upload PyCue Tar |
| 209 | + uses: actions/upload-release-asset@v1 |
| 210 | + env: |
| 211 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 212 | + with: |
| 213 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 214 | + asset_path: ${{ github.workspace }}/artifacts/pycue-${{ env.BUILD_ID }}-all.tar.gz |
| 215 | + asset_name: pycue-${{ env.BUILD_ID }}-all.tar.gz |
| 216 | + asset_content_type: application/octet-stream |
| 217 | + |
| 218 | + - name: Upload PyOutline Tar |
| 219 | + uses: actions/upload-release-asset@v1 |
| 220 | + env: |
| 221 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 222 | + with: |
| 223 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 224 | + asset_path: ${{ github.workspace }}/artifacts/pyoutline-${{ env.BUILD_ID }}-all.tar.gz |
| 225 | + asset_name: pyoutline-${{ env.BUILD_ID }}-all.tar.gz |
| 226 | + asset_content_type: application/octet-stream |
| 227 | + |
| 228 | + - name: Upload CueSubmit Tar |
| 229 | + uses: actions/upload-release-asset@v1 |
| 230 | + env: |
| 231 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 232 | + with: |
| 233 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 234 | + asset_path: ${{ github.workspace }}/artifacts/cuesubmit-${{ env.BUILD_ID }}-all.tar.gz |
| 235 | + asset_name: cuesubmit-${{ env.BUILD_ID }}-all.tar.gz |
| 236 | + asset_content_type: application/octet-stream |
| 237 | + |
| 238 | + - name: Upload CueAdmin Tar |
| 239 | + uses: actions/upload-release-asset@v1 |
| 240 | + env: |
| 241 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 242 | + with: |
| 243 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 244 | + asset_path: ${{ github.workspace }}/artifacts/cueadmin-${{ env.BUILD_ID }}-all.tar.gz |
| 245 | + asset_name: cueadmin-${{ env.BUILD_ID }}-all.tar.gz |
| 246 | + asset_content_type: application/octet-stream |
0 commit comments