Last active
September 19, 2021 02:22
-
-
Save c-bata/ed5e7b7f8015502ee5092a3e77937c99 to your computer and use it in GitHub Desktop.
Github Actions Workflow to build your sphinx documentation and upload it to Google Cloud Storage.
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: release | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
release: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Set up Python 3.7 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.7 | |
- name: Install dependencies | |
run: | | |
sudo apt install pandoc | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Build sphinx documentation | |
run: | | |
make html | |
- name: gcloud auth | |
uses: actions/gcloud/auth@master | |
env: | |
GCLOUD_AUTH: ${{ secrets.GCLOUD_AUTH }} | |
- name: Upload to GCS | |
env: | |
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} | |
GCLOUD_AUTH: ${{ secrets.GCLOUD_AUTH }} | |
GOOGLE_APPLICATION_CREDENTIALS: ./service-account.json | |
run: | | |
export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" | |
echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list | |
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get install google-cloud-sdk | |
echo ${GCLOUD_AUTH} | base64 --decode > ${GOOGLE_APPLICATION_CREDENTIALS} | |
gcloud auth activate-service-account --key-file $GOOGLE_APPLICATION_CREDENTIALS | |
gcloud config set project ${PROJECT_ID} | |
gsutil mv -r ./build/html/* gs://<your-bucket>/ # please replace here. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment