|
9 | 9 | - master |
10 | 10 |
|
11 | 11 | env: |
12 | | - SERVER_TAG: ghcr.io/eclipse/openvsx-server |
13 | | - WEBUI_TAG: ghcr.io/eclipse/openvsx-webui |
| 12 | + REGISTRY: ghcr.io |
| 13 | + SERVER_IMAGE: openvsx-server |
| 14 | + WEBUI_IMAGE: openvsx-webui |
14 | 15 |
|
15 | 16 | jobs: |
16 | | - build: |
| 17 | + build-and-push-cli-and-webui: |
17 | 18 | permissions: |
18 | | - contents: none |
| 19 | + contents: read |
| 20 | + packages: write |
| 21 | + id-token: write |
19 | 22 | runs-on: ubuntu-latest |
20 | 23 | steps: |
| 24 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 |
| 25 | + with: |
| 26 | + persist-credentials: false |
| 27 | + |
21 | 28 | - name: Set up Node.js |
22 | | - uses: actions/setup-node@v4 |
| 29 | + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 |
23 | 30 | with: |
24 | 31 | node-version: 18.x |
25 | | - - name: Set up JDK |
26 | | - uses: actions/setup-java@v4 |
27 | | - with: |
28 | | - distribution: 'temurin' |
29 | | - java-version: 25 |
| 32 | + |
30 | 33 | - name: Install Yarn |
31 | 34 | run: | |
32 | 35 | corepack enable |
33 | 36 | corepack prepare yarn@stable --activate |
34 | | - - uses: actions/checkout@v4 |
35 | | - - name: Set Image Version |
36 | | - run: echo "IMAGE_VERSION=${GITHUB_SHA:0:7}" >> $GITHUB_ENV |
| 37 | +
|
37 | 38 | - name: Build CLI |
38 | 39 | run: yarn --cwd cli |
39 | | - - name: Build Web UI Image |
40 | | - run: docker build -t $WEBUI_TAG:$IMAGE_VERSION webui |
| 40 | + |
| 41 | + - name: Log in to the Container registry |
| 42 | + uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 |
| 43 | + with: |
| 44 | + registry: ${{ env.REGISTRY }} |
| 45 | + username: ${{ github.actor }} |
| 46 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 47 | + |
| 48 | + - name: Extract metadata (tags, labels) for Docker |
| 49 | + id: meta |
| 50 | + uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0 |
| 51 | + with: |
| 52 | + images: | |
| 53 | + ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.WEBUI_IMAGE }} |
| 54 | + tags: |
| 55 | + type=sha,prefix= |
| 56 | + labels: | |
| 57 | + org.opencontainers.image.title=OpenVSX WebUI |
| 58 | +
|
| 59 | + - name: Build and push Web UI Image |
| 60 | + uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 |
| 61 | + with: |
| 62 | + context: webui |
| 63 | + # only push to ghcr.io in the upstream repo when pushing to the master branch |
| 64 | + push: ${{ github.repository_owner == 'eclipse' && github.event_name == 'push' && github.ref == 'refs/heads/master' }} |
| 65 | + tags: ${{ steps.meta.outputs.tags }} |
| 66 | + labels: ${{ steps.meta.outputs.labels }} |
| 67 | + |
| 68 | + build-and-push-server: |
| 69 | + permissions: |
| 70 | + contents: read |
| 71 | + packages: write |
| 72 | + id-token: write |
| 73 | + runs-on: ubuntu-latest |
| 74 | + steps: |
| 75 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 |
| 76 | + with: |
| 77 | + persist-credentials: false |
| 78 | + |
| 79 | + - name: Set up JDK |
| 80 | + uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0 |
| 81 | + with: |
| 82 | + distribution: 'temurin' |
| 83 | + java-version: 25 |
| 84 | + |
41 | 85 | - name: Get all changed server files |
42 | 86 | id: changed_server_files |
43 | | - uses: tj-actions/[email protected] |
| 87 | + uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5 |
44 | 88 | with: |
45 | 89 | files: server/** |
| 90 | + |
46 | 91 | - name: Run Server Tests |
47 | 92 | if: steps.changed_server_files.outputs.any_changed == 'true' |
48 | 93 | run: server/gradlew --no-daemon -p server check |
49 | 94 | env: |
50 | 95 | DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_API_TOKEN }} |
51 | | - - name: Build Server Image |
52 | | - run: docker build -t $SERVER_TAG:$IMAGE_VERSION server --secret id=dv-key,env=DEVELOCITY_ACCESS_KEY |
| 96 | + |
| 97 | + - name: Log in to the Container registry |
| 98 | + uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 |
| 99 | + with: |
| 100 | + registry: ${{ env.REGISTRY }} |
| 101 | + username: ${{ github.actor }} |
| 102 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 103 | + |
| 104 | + - name: Extract metadata (tags, labels) for Docker |
| 105 | + id: meta |
| 106 | + uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0 |
| 107 | + with: |
| 108 | + images: | |
| 109 | + ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.SERVER_IMAGE }} |
| 110 | + tags: |
| 111 | + type=sha,prefix= |
| 112 | + labels: | |
| 113 | + org.opencontainers.image.title=OpenVSX Server |
| 114 | +
|
| 115 | + - name: Build and push Server Image |
| 116 | + uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 |
53 | 117 | env: |
54 | 118 | DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_API_TOKEN }} |
55 | | - - name: Push Docker Images |
56 | | - run: | |
57 | | - echo ${{ secrets.BOT_ACCESS_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin |
58 | | - docker push $SERVER_TAG:$IMAGE_VERSION |
59 | | - docker push $WEBUI_TAG:$IMAGE_VERSION |
60 | | - if: github.repository == 'eclipse/openvsx' && github.ref == 'refs/heads/master' |
| 119 | + with: |
| 120 | + context: server |
| 121 | + # only push to ghcr.io in the upstream repo when pushing to the master branch |
| 122 | + push: ${{ github.repository_owner == 'eclipse' && github.event_name == 'push' && github.ref == 'refs/heads/master' }} |
| 123 | + tags: ${{ steps.meta.outputs.tags }} |
| 124 | + labels: ${{ steps.meta.outputs.labels }} |
| 125 | + secrets: | |
| 126 | + "dv-key=${{ secrets.DEVELOCITY_ACCESS_KEY }}" |
| 127 | +
|
| 128 | + save-pr-number: |
| 129 | + permissions: |
| 130 | + contents: none |
| 131 | + runs-on: ubuntu-latest |
| 132 | + if: github.event_name == 'pull_request' |
| 133 | + steps: |
61 | 134 | - name: Save PR number to file |
62 | | - if: github.event_name == 'pull_request' |
63 | 135 | run: echo ${{ github.event.number }} > PR_NUMBER.txt |
| 136 | + |
64 | 137 | - name: Archive PR number |
65 | | - if: github.event_name == 'pull_request' |
66 | | - uses: actions/upload-artifact@v4 |
| 138 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
67 | 139 | with: |
68 | 140 | name: PR_NUMBER |
69 | 141 | path: PR_NUMBER.txt |
0 commit comments