|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + |
| 7 | +jobs: |
| 8 | + build: |
| 9 | + runs-on: ubuntu-24.04 |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v4 |
| 12 | + with: |
| 13 | + fetch-depth: "0" # necessary for `npm run print-version` |
| 14 | + |
| 15 | + - uses: pnpm/action-setup@v4 |
| 16 | + name: Install pnpm |
| 17 | + with: |
| 18 | + run_install: false |
| 19 | + - name: Install Node.js |
| 20 | + uses: actions/setup-node@v4 |
| 21 | + with: |
| 22 | + node-version: 20 |
| 23 | + cache: 'pnpm' |
| 24 | + |
| 25 | + - name: Install dependencies |
| 26 | + run: pnpm install |
| 27 | + |
| 28 | + - name: copy config.build |
| 29 | + run: cp -R config.build node_modules/config |
| 30 | + |
| 31 | + |
| 32 | + - name: Build |
| 33 | + run: pnpm build |
| 34 | + |
| 35 | + - name: Docker meta |
| 36 | + id: meta |
| 37 | + uses: docker/metadata-action@v5 |
| 38 | + with: |
| 39 | + images: | |
| 40 | + docker.io/fnndsc/chris_ui |
| 41 | + ghcr.io/fnndsc/chris_ui |
| 42 | + tags: | |
| 43 | + type=ref,event=branch |
| 44 | + type=ref,event=pr |
| 45 | + type=raw,value=latest,enable={{is_default_branch}} |
| 46 | + type=sha,format=short,prefix= |
| 47 | + - uses: docker/setup-qemu-action@v3 |
| 48 | + - uses: docker/setup-buildx-action@v3 |
| 49 | + with: |
| 50 | + driver-opts: network=host |
| 51 | + - name: Login to DockerHub |
| 52 | + id: dockerhub_login |
| 53 | + continue-on-error: true |
| 54 | + uses: docker/login-action@v3 |
| 55 | + with: |
| 56 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 57 | + password: ${{ secrets.DOCKERHUB_PASSWORD }} |
| 58 | + - name: Login to GitHub Container Registry |
| 59 | + id: ghcr_login |
| 60 | + continue-on-error: true |
| 61 | + uses: docker/login-action@v3 |
| 62 | + with: |
| 63 | + registry: ghcr.io |
| 64 | + username: ${{ github.repository_owner }} |
| 65 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 66 | + |
| 67 | + - name: Build and push |
| 68 | + uses: docker/build-push-action@v6 |
| 69 | + with: |
| 70 | + tags: ${{ steps.meta.outputs.tags }} |
| 71 | + context: . |
| 72 | + file: ./Dockerfile |
| 73 | + platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7,linux/386 |
| 74 | + push: ${{ steps.dockerhub_login.outcome == 'success' && steps.ghcr_login.outcome == 'success' }} |
| 75 | + |
| 76 | + - name: Update DockerHub description |
| 77 | + uses: peter-evans/dockerhub-description@v4 |
| 78 | + if: github.event_name == 'push' && github.ref == 'refs/heads/master' && steps.dockerhub_login.outcome == 'success' |
| 79 | + with: |
| 80 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 81 | + password: ${{ secrets.DOCKERHUB_PASSWORD }} |
| 82 | + short-description: ChRIS user interface |
| 83 | + readme-filepath: ./README.md |
| 84 | + repository: fnndsc/chris_ui |
0 commit comments