|
1 | 1 | name: auto-test-and-document.yml |
2 | 2 | on: |
| 3 | + workflow_dispatch: |
| 4 | + # pull_request: |
| 5 | + # branches: [ "main" ] |
| 6 | + push: |
| 7 | + tags: |
| 8 | + - '**' |
3 | 9 |
|
4 | 10 | jobs: |
| 11 | + build-and-push: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + tag_suffix: ["", "-single-host"] |
| 16 | + include: |
| 17 | + - tag_suffix: "" |
| 18 | + path_name: "" |
| 19 | + - tag_suffix: "-single-host" |
| 20 | + path_name: "/seb-server-gui" |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Set env for dynamic tag |
| 24 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') |
| 25 | + run: echo "TAG_NAME=${GITHUB_REF#refs/*/}${{ matrix.tag_suffix }}" >> $GITHUB_ENV |
| 26 | + |
| 27 | + - name: Set env manual |
| 28 | + if: github.event_name == 'workflow_dispatch' |
| 29 | + run: echo "TAG_NAME=default_version${{ matrix.tag_suffix }}" >> $GITHUB_ENV |
| 30 | + |
| 31 | + - name: Checkout code |
| 32 | + uses: actions/checkout@v4.2.2 |
| 33 | + |
| 34 | + - name: Login to DockerHub |
| 35 | + uses: docker/login-action@v3.4.0 |
| 36 | + with: |
| 37 | + username: naritter |
| 38 | + password: ${{ secrets.DOCKERHUB_PASSWORD}} |
| 39 | + |
| 40 | + - name: Build and push Docker image |
| 41 | + uses: docker/build-push-action@v6.17.0 |
| 42 | + with: |
| 43 | + context: . |
| 44 | + push: true |
| 45 | + tags: docker.io/naritter/seb-server-gui:${{ env.TAG_NAME }} |
| 46 | + build-args: VITE_SUB_PATH=${{ matrix.path_name }} |
| 47 | + |
| 48 | + build-and-push-admin: |
| 49 | + runs-on: ubuntu-latest |
| 50 | + strategy: |
| 51 | + matrix: |
| 52 | + tag_suffix: [ "", "-single-host" ] |
| 53 | + include: |
| 54 | + - tag_suffix: "" |
| 55 | + path_name: "" |
| 56 | + - tag_suffix: "-single-host" |
| 57 | + path_name: "/seb-server-gui" |
| 58 | + |
| 59 | + steps: |
| 60 | + - name: Set env for dynamic tag |
| 61 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') |
| 62 | + run: echo "TAG_NAME=${GITHUB_REF#refs/*/}${{ matrix.tag_suffix }}" >> $GITHUB_ENV |
| 63 | + |
| 64 | + - name: Set env manual |
| 65 | + if: github.event_name == 'workflow_dispatch' |
| 66 | + run: echo "TAG_NAME=default_version${{ matrix.tag_suffix }}" >> $GITHUB_ENV |
| 67 | + |
| 68 | + - name: Checkout code |
| 69 | + uses: actions/checkout@v4.2.2 |
| 70 | + |
| 71 | + - name: Login to DockerHub |
| 72 | + uses: docker/login-action@v3.4.0 |
| 73 | + with: |
| 74 | + username: ${{ secrets.DOCKERHUB_ADMIN_USERNAME }} |
| 75 | + password: ${{ secrets.DOCKERHUB_ADMIN_TOKEN }} |
| 76 | + |
| 77 | + - name: Build and push Docker image |
| 78 | + uses: docker/build-push-action@v6.17.0 |
| 79 | + with: |
| 80 | + context: . |
| 81 | + push: true |
| 82 | + tags: docker.io/${{ secrets.DOCKERHUB_ADMIN_USERNAME }}/seb-server-gui:${{ env.TAG_NAME }} |
| 83 | + build-args: VITE_SUB_PATH=${{ matrix.path_name }} |
0 commit comments