|
4 | 4 | push: |
5 | 5 | branches: |
6 | 6 | - main |
7 | | - - release-* |
8 | | - workflow_dispatch: {} |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + version: |
| 10 | + description: Package version (e.g. v0.1.0) |
| 11 | + required: false |
9 | 12 |
|
10 | 13 | env: |
11 | | - DOCKER_BUILDX_VERSION: 'v0.8.2' |
12 | | - |
13 | | - XPKG_ACCESS_ID: ${{ secrets.XPKG_ACCESS_ID }} |
| 14 | + UP_API_TOKEN: ${{ secrets.UP_API_TOKEN }} |
| 15 | + UP_ROBOT_ID: ${{ secrets.UP_ROBOT_ID }} |
| 16 | + UP_ORG: ${{ secrets.UP_ORG }} |
| 17 | + XPKG_REGISTRY: xpkg.upbound.io |
14 | 18 |
|
15 | 19 | jobs: |
16 | | - detect-noop: |
17 | | - runs-on: ubuntu-24.04 |
18 | | - outputs: |
19 | | - noop: ${{ steps.noop.outputs.should_skip }} |
20 | | - steps: |
21 | | - - name: Detect No-op Changes |
22 | | - id: noop |
23 | | - uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf # v5.3.1 |
24 | | - with: |
25 | | - github_token: ${{ secrets.GITHUB_TOKEN }} |
26 | | - paths_ignore: '["**.md", "**.png", "**.jpg"]' |
27 | | - do_not_skip: '["workflow_dispatch", "schedule", "push"]' |
28 | | - |
29 | | - publish-artifacts: |
30 | | - runs-on: ubuntu-24.04 |
31 | | - needs: detect-noop |
32 | | - if: needs.detect-noop.outputs.noop != 'true' |
33 | | - |
| 20 | + deploy: |
| 21 | + runs-on: ubuntu-latest |
34 | 22 | steps: |
35 | | - - name: Setup Docker Buildx |
36 | | - uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3 |
37 | | - with: |
38 | | - version: ${{ env.DOCKER_BUILDX_VERSION }} |
39 | | - install: true |
40 | | - |
41 | 23 | - name: Checkout |
42 | | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 |
43 | | - with: |
44 | | - submodules: true |
45 | | - |
46 | | - - name: Fetch History |
47 | | - run: git fetch --prune --unshallow |
| 24 | + id: checkout |
| 25 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 |
48 | 26 |
|
49 | | - - name: Build Artifacts |
50 | | - run: make -j2 build.all |
51 | | - env: |
52 | | - # We're using docker buildx, which doesn't actually load the images it |
53 | | - # builds by default. Specifying --load does so. |
54 | | - BUILD_ARGS: "--load" |
55 | | - |
56 | | - - name: Publish Artifacts to GitHub |
57 | | - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 |
| 27 | + - name: Install and login with up |
| 28 | + if: env.UP_API_TOKEN != '' && env.UP_ORG != '' |
| 29 | + uses: upbound/action-up@53fe6395637d884c80d2bbc8c2d75d0ece776ced # v1 |
58 | 30 | with: |
59 | | - name: output |
60 | | - path: _output/** |
| 31 | + api-token: ${{ secrets.UP_API_TOKEN }} |
| 32 | + organization: ${{ secrets.UP_ORG }} |
61 | 33 |
|
62 | | - - name: Login to Upbound |
63 | | - uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3 |
64 | | - if: env.XPKG_ACCESS_ID != '' |
| 34 | + # doesn't work with plain token when pushing otherwise |
| 35 | + - name: Login to xpkg with robot |
| 36 | + uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3 |
65 | 37 | with: |
66 | | - registry: xpkg.upbound.io |
67 | | - username: ${{ secrets.XPKG_ACCESS_ID }} |
68 | | - password: ${{ secrets.XPKG_TOKEN }} |
| 38 | + registry: ${{ env.XPKG_REGISTRY }} |
| 39 | + username: ${{ env.UP_ROBOT_ID }} |
| 40 | + password: ${{ env.UP_API_TOKEN }} |
69 | 41 |
|
70 | | - - name: Publish Artifacts |
71 | | - if: env.XPKG_ACCESS_ID != '' |
72 | | - run: make -j2 publish BRANCH_NAME=${GITHUB_REF##*/} |
| 42 | + - name: Build and Push Upbound project |
| 43 | + if: env.UP_API_TOKEN != '' |
| 44 | + uses: upbound/action-up-project@b849ec1eb303ae4abf22b2b86c0e2afca155137b # v1 |
| 45 | + with: |
| 46 | + push-project: true |
| 47 | + tag: ${{ inputs.version || '' }} |
| 48 | + # login-check does `up org list` which doesn't work with a robot-token |
| 49 | + skip-login-check: true |
| 50 | + |
| 51 | + - name: Append icon overlay to package |
| 52 | + if: env.UP_API_TOKEN != '' && hashFiles('./extensions') != '' && inputs.version != '' |
| 53 | + run: | |
| 54 | + PROJECT_NAME=$(yq '.metadata.name' upbound.yaml) |
| 55 | + PACKAGE_REF="${{ env.XPKG_REGISTRY }}/${{ env.UP_ORG }}/${PROJECT_NAME}:${{ inputs.version }}" |
| 56 | + up alpha xpkg append --extensions-root=./extensions ${PACKAGE_REF} |
0 commit comments