|
| 1 | +on: |
| 2 | + workflow_dispatch: |
| 3 | + push: |
| 4 | + tags: |
| 5 | + # CF: 17.x-YYYY-MM-DD |
| 6 | + - '*.x-*-*-*' |
| 7 | + |
| 8 | +name: Create release |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + name: Create release from tag |
| 12 | + if: github.repository_owner == 'opencast' |
| 13 | + runs-on: ubuntu-latest |
| 14 | + permissions: |
| 15 | + contents: write #for the release |
| 16 | + pull-requests: write #For the PR in the upstream repo |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: checkout code |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: get node.js |
| 23 | + uses: actions/setup-node@v4 |
| 24 | + with: |
| 25 | + node-version: 20 |
| 26 | + |
| 27 | + - name: download dependencies |
| 28 | + run: npm ci |
| 29 | + |
| 30 | + - name: build release |
| 31 | + env: |
| 32 | + PUBLIC_URL: /admin-ui |
| 33 | + run: npm run build |
| 34 | + |
| 35 | + - name: create release tarball |
| 36 | + working-directory: build |
| 37 | + run: | |
| 38 | + tar -czf "../oc-admin-ui-$(git describe --tags).tar.gz" * |
| 39 | + echo INTERFACE_CHECKSUM=`sha256sum oc-admin-ui-$(git describe --tags).tar.gz | cut -f 1 -d " "` >> $GITHUB_ENV |
| 40 | + echo INTERFACE_TAG=$(git describe --tags) >> $GITHUB_ENV |
| 41 | + echo BASE_BRANCH=$(git describe --tags | cut -c 1-4) >> $GITHUB_ENV |
| 42 | +
|
| 43 | + - name: create new release |
| 44 | + uses: softprops/action-gh-release@v2 |
| 45 | + with: |
| 46 | + files: oc-admin-ui-*.tar.gz |
| 47 | + fail_on_unmatched_files: true |
| 48 | + generate_release_notes: true |
| 49 | + |
| 50 | + - name: Prepare git |
| 51 | + run: | |
| 52 | + git config --global user.name "Release Bot" |
| 53 | + git config --global user.email "cloud@opencast.org" |
| 54 | +
|
| 55 | + - name: Prepare GitHub SSH key |
| 56 | + env: |
| 57 | + DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} |
| 58 | + run: | |
| 59 | + install -dm 700 ~/.ssh/ |
| 60 | + echo "${DEPLOY_KEY}" > ~/.ssh/id_ed25519 |
| 61 | + chmod 600 ~/.ssh/id_ed25519 |
| 62 | + ssh-keyscan github.com >> ~/.ssh/known_hosts |
| 63 | +
|
| 64 | + - name: Clone upstream repository |
| 65 | + run: | |
| 66 | + #This token is an account wide token which allows creation of PRs and pushes. |
| 67 | + #echo "GH_TOKEN=${{ secrets.ACCESS_TOKEN }}" >> token.txt |
| 68 | + #gh auth login --with-token < token.txt |
| 69 | + git clone -b r/$BASE_BRANCH "git@github.com:opencast/opencast.git" ~/opencast |
| 70 | + cd ~/opencast |
| 71 | + git checkout -b t/admin-ui-$INTERFACE_TAG |
| 72 | +
|
| 73 | + - name: Update the admin ui pom file |
| 74 | + #env: |
| 75 | + # GH_TOKEN: ${{ github.token }} |
| 76 | + run: | |
| 77 | + cd ~/opencast |
| 78 | + sed -i "s#<interface.sha256>.*</interface.sha256>#<interface.sha256>$INTERFACE_CHECKSUM</interface.sha256>#" modules/admin-ui-interface/pom.xml |
| 79 | + sed -i "s#<interface.url>.*</interface.url>#<interface.url>https://github.com/opencast/opencast-admin-interface/releases/download/$INTERFACE_TAG/oc-admin-ui-$INTERFACE_TAG.tar.gz</interface.url>#" modules/admin-ui-interface/pom.xml |
| 80 | + git add modules/admin-ui-interface/pom.xml |
| 81 | + git commit -m "Updating admin ui to $INTERFACE_TAG" |
| 82 | + git push origin t/admin-ui-$INTERFACE_TAG |
| 83 | + #This token is an account wide token which allows creation of PRs and pushes. |
| 84 | + echo "${{ secrets.PR_TOKEN }}" > token.txt |
| 85 | + gh auth login --with-token < token.txt |
| 86 | + gh pr create --title "Update $BASE_BRANCH Admin UI to $INTERFACE_TAG" --label admin-ui --label maintenance --body "Updating Opencast $BASE_BRANCH Admin UI module to $INTERFACE_TAG" --head=opencast:t/admin-ui-$INTERFACE_TAG --base r/$BASE_BRANCH -R opencast/opencast |
0 commit comments