CD #415
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CD | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
on: | |
workflow_run: | |
workflows: ["CI"] | |
types: | |
- completed | |
branches: | |
- main | |
permissions: {} | |
jobs: | |
publish-latest-update-site: | |
name: Publish Latest Update Site # (from main branch only) | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
# we are very restrictive when this runs, i.e. only on main, only on success and only with the bazel-eclipse repository (not on forks) | |
if: > | |
github.event.workflow_run.conclusion == 'success' && | |
github.event.workflow_run.event != 'pull_request' && | |
github.repository == 'salesforce/bazel-eclipse' && | |
github.ref == 'refs/heads/main' | |
# set permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download p2 Repository | |
uses: dawidd6/action-download-artifact@v6 | |
with: | |
run_id: ${{ github.event.workflow_run.id }} | |
name: p2-repository | |
path: bazel-eclipse-latest | |
skip_unpack: true | |
- name: Extract p2 Repository | |
run: unzip bazel-eclipse-latest/p2-repository.zip -d bazel-eclipse-latest | |
- name: Assemble pages folder | |
run: | | |
mkdir -p _site/latest | |
cp -rfv bazel-eclipse-latest/* _site/latest/ | |
cp -rfv .github/pages/* _site/ | |
chmod -c -R +rX "_site/" | while read line; do | |
echo "::warning title=Invalid file permissions automatically fixed::$line" | |
done | |
- name: Display structure of the site | |
run: ls -R _site/ | |
- name: Upload pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
- name: Deploy Update Site 🚀 | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
- name: Trigger VS Code Extension publish workflow | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.BAZEL_VSCODE_JAVA_TOKEN }} | |
script: | | |
await github.rest.actions.createWorkflowDispatch({ | |
owner: 'salesforce', | |
repo: 'bazel-vscode-java', | |
workflow_id: 'publish.yml', | |
ref: 'main', | |
inputs: { | |
releaseChannel: 'edge' | |
} | |
}); |