|
| 1 | +name: All |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "**" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "main" ] |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: "all" |
| 11 | + cancel-in-progress: false |
| 12 | + |
| 13 | +jobs: |
| 14 | + run: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + permissions: write-all |
| 17 | + steps: |
| 18 | + - name: Install dependencies |
| 19 | + run: | |
| 20 | + sudo apt update |
| 21 | + sudo apt install -y llvm-dev libclang-dev clang |
| 22 | + - name: Install rust |
| 23 | + uses: moonrepo/setup-rust@v1 |
| 24 | + - name: Checkout code |
| 25 | + uses: actions/checkout@v4 |
| 26 | + - name: Build project |
| 27 | + run: cargo build |
| 28 | + - name: Test project |
| 29 | + run: cargo test |
| 30 | + - name: Setup Pages |
| 31 | + # if: github.ref == 'refs/heads/main' |
| 32 | + uses: actions/configure-pages@v5 |
| 33 | + - name: Create documents |
| 34 | + # if: github.ref == 'refs/heads/main' |
| 35 | + run: cargo doc --no-deps |
| 36 | + - name: Upload documents artifact |
| 37 | + # if: github.ref == 'refs/heads/main' |
| 38 | + uses: actions/upload-pages-artifact@v3 |
| 39 | + with: |
| 40 | + path: './target/doc/' |
| 41 | + - name: Deploy to GitHub Pages |
| 42 | + # if: github.ref == 'refs/heads/main' |
| 43 | + id: deployment |
| 44 | + uses: actions/deploy-pages@v4 |
| 45 | + - name: Login to Github registry |
| 46 | + # if: github.ref == 'refs/heads/main' |
| 47 | + uses: docker/login-action@v2 |
| 48 | + with: |
| 49 | + registry: ghcr.io |
| 50 | + username: ${{ github.actor }} |
| 51 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 52 | + - name: Build Docker images |
| 53 | + # if: github.ref == 'refs/heads/main' |
| 54 | + run: | |
| 55 | + docker build . --tag ghcr.io/${{ github.repository }}/journal-sdk:latest |
| 56 | + docker build . --tag ghcr.io/${{ github.repository }}/journal-sdk:$( cargo pkgid | cut -d '@' -f 2 ) |
| 57 | + - name: Push Docker images |
| 58 | + # if: github.ref == 'refs/heads/main' |
| 59 | + run: | |
| 60 | + docker push ghcr.io/${{ github.repository }}/journal-sdk:latest |
| 61 | + docker push ghcr.io/${{ github.repository }}/journal-sdk:$( cargo pkgid | cut -d '@' -f 2 ) |
0 commit comments