Skip to content

Commit

Permalink
CI release bug fixes (#1611)
Browse files Browse the repository at this point in the history
* Fix main branch detection for docker build

* Try out GHA for Pages deployment

* Docker build clean up workflow

* publish docker in all non-PR events

* fix docs cache (github token)

* Deploy docs only from main branch

* revert docker build machine size
  • Loading branch information
gpmayorga authored Nov 21, 2023
1 parent 55570cc commit 6330858
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 25 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- ".github/workflows/build-docker.yml"
- "docker/centrifuge-chain/Dockerfile"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}${{ github.ref == '/refs/heads/main' && github.sha || 'false' }}
group: ${{ github.workflow }}-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}${{ github.event_name }}
cancel-in-progress: true
jobs:
docker:
Expand All @@ -34,12 +34,6 @@ jobs:
docker volume ls
df -h
- name: Install toolchain from rust-toolchain.toml
shell: sh
run: |
TOOLCHAIN_VERSION=$(grep 'channel =' rust-toolchain.toml | awk -F'"' '{print $2}')
rustup toolchain install "$TOOLCHAIN_VERSION"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 #v3
- name: DockerHub Login
Expand All @@ -64,7 +58,7 @@ jobs:
type=semver,pattern={{major}},prefix=${{ matrix.target == 'test' && 'test-' || '' }},suffix=
type=edge
- name: Configure sccache
- name: Configure GHA cache
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 #v6
with:
script: |
Expand All @@ -78,7 +72,7 @@ jobs:
file: ./docker/centrifuge-chain/Dockerfile
build-args: |
FEATURES=${{ matrix.target == 'test' && 'fast-runtime' || '' }}
push: ${{ github.ref == '/refs/heads/main' && true || false }}
push: ${{ github.event_name == 'pull_request' && false || true }}
tags: ${{ steps.meta.outputs.tags }}
# Cache options:
# https://docs.docker.com/build/ci/github-actions/cache/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
uses: ./.github/actions/prep-ubuntu

# sccache does not work inside the srtool container
- uses: Swatinem/rust-cache@e207df5d269b42b69c8bc5101da26f7d31feddb4 # 2.6.2
- uses: Swatinem/rust-cache@3cf7f8cc28d1b4e7d01e3783be10a97d55d483c8 # 2.7
with:
prefix-key: build
shared-key: wasm
Expand Down
38 changes: 23 additions & 15 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,18 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
docs:
build-docs:
permissions:
contents: write
contents: read
id-token: write
runs-on: ubuntu-latest-4-cores
env:
RUSTDOCFLAGS: "-D warnings"
RUSTC_WRAPPER: "sccache"
steps:
- name: Checkout repository
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac #v4

- name: Prep build on Ubuntu
uses: ./.github/actions/prep-ubuntu
with:
RUST_TOOLCHAIN: ${{ env.RUST_TOOLCHAIN }}
cache: enabled
# Cache needs Google credentials:
GWIP: ${{ secrets.GWIP_SCCACHE }}
Expand All @@ -31,7 +27,9 @@ jobs:
- name: Build documentation
id: build_docs
run: cargo doc --all --no-deps

env:
RUSTDOCFLAGS: "-D warnings"
RUSTC_WRAPPER: "sccache"

- name: Build Documentation failed
if: always() && steps.build_docs.outcome == 'failure'
Expand All @@ -43,12 +41,22 @@ jobs:
run: |
echo "<meta http-equiv=\"refresh\" content=\"0; url=centrifuge_chain/index.html\">" \ > ./target/doc/index.html
- name: Deploy Docs
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # 3.9.3
if: github.ref == 'refs/heads/main'
- name: upload Docs files
uses: actions/upload-pages-artifact@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./target/doc
cname: reference.centrifuge.io
force_orphan: true
path: ./target/doc

deploy-docs:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
pages: write # to deploy to Pages
id-token: write
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy Docs
id: deployment
uses: actions/deploy-pages@v2

0 comments on commit 6330858

Please sign in to comment.