Merge pull request #105 from cipherstash/remediate-vulnerabilities #55
This file contains hidden or 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: Deploy public docs to rustdoc-cipherstash-com | |
on: | |
push: | |
branches: | |
- main # Trigger the workflow on push to the main branch | |
jobs: | |
copy-docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Source Repo | |
id: source | |
uses: actions/checkout@v4 | |
with: | |
path: cipherstash-dynamodb | |
- name: Get Source Commit Hash | |
id: get-source-hash | |
run: echo "::set-output name=hash::$(git -C cipherstash-dynamodb rev-parse --short HEAD)" | |
- name: Checkout Dest Repo | |
uses: actions/checkout@v4 | |
with: | |
repository: "cipherstash/rustdoc-cipherstash-com" | |
path: rustdoc-cipherstash-com | |
ssh-key: ${{ secrets.CS_RUSTDOC_SYNC_DEST_REPO_DEPLOY_KEY }} | |
fetch-depth: 0 # Necessary for pushing commits | |
- name: Generate Docs | |
env: | |
CARGO_REGISTRIES_CIPHERSTASH_TOKEN: ${{ secrets.CARGO_REGISTRIES_CIPHERSTASH_TOKEN }} | |
run: | | |
cd cipherstash-dynamodb | |
cargo doc --no-deps -p cipherstash-dynamodb -p cipherstash-client | |
- name: Copy Docs | |
run: | | |
set -e | |
mkdir -p rustdoc-cipherstash-com/public/cipherstash_dynamodb/ | |
mkdir -p rustdoc-cipherstash-com/public/cipherstash_client/ | |
mkdir -p rustdoc-cipherstash-com/public/static.files/ | |
cd cipherstash-dynamodb/ | |
cp -r target/doc/static.files/* ../rustdoc-cipherstash-com/public/static.files/ | |
cd target/doc/cipherstash_dynamodb/ | |
truncate -s 0 crates.js | |
cp -r * ../../../../rustdoc-cipherstash-com/public/cipherstash_dynamodb/ | |
cd ../cipherstash_client/ | |
truncate -s 0 crates.js | |
cp -r * ../../../../rustdoc-cipherstash-com/public/cipherstash_client/ | |
- name: Check for Changes | |
id: check-changes | |
run: | | |
cd rustdoc-cipherstash-com | |
git add . | |
if git diff --cached --quiet; then | |
echo "::set-output name=changes::false" | |
else | |
echo "::set-output name=changes::true" | |
fi | |
- name: Commit Changes | |
if: steps.check-changes.outputs.changes == 'true' | |
run: | | |
cd rustdoc-cipherstash-com | |
git config --global user.name 'github-actions-cj-vercel-account[bot]' | |
git config --global user.email '[email protected]' | |
git commit -m "Update docs from cipherstash-dynamodb repo at commit ${{ steps.get-source-hash.outputs.hash }}" | |
- name: Push Changes | |
if: steps.check-changes.outputs.changes == 'true' | |
run: | | |
cd rustdoc-cipherstash-com | |
git push origin main |