|
| 1 | +name: JuiceFS CSI Release |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - master |
| 6 | + - release-* |
| 7 | + |
| 8 | +jobs: |
| 9 | + release: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + outputs: |
| 12 | + version: ${{ steps.version.outputs.version }} |
| 13 | + steps: |
| 14 | + - name: "Checkout Code" |
| 15 | + uses: actions/checkout@v4 |
| 16 | + with: |
| 17 | + fetch-depth: 0 |
| 18 | + |
| 19 | + - name: Determine version |
| 20 | + id: version |
| 21 | + run: | |
| 22 | + # Get the latest tag that matches v* pattern |
| 23 | + LATEST_TAG=$(git describe --tags --match 'v*' --abbrev=0 2>/dev/null || echo "v0.0.0") |
| 24 | +
|
| 25 | + # Extract major, minor, patch |
| 26 | + VERSION=${LATEST_TAG#v} |
| 27 | + MAJOR=$(echo $VERSION | cut -d. -f1) |
| 28 | + MINOR=$(echo $VERSION | cut -d. -f2) |
| 29 | + PATCH=$(echo $VERSION | cut -d. -f3) |
| 30 | +
|
| 31 | + # Increment patch version |
| 32 | + PATCH=$((PATCH + 1)) |
| 33 | + NEXT_VERSION="v${MAJOR}.${MINOR}.${PATCH}" |
| 34 | +
|
| 35 | + echo "version=${NEXT_VERSION}" >> $GITHUB_OUTPUT |
| 36 | + echo "Next version: ${NEXT_VERSION}" |
| 37 | +
|
| 38 | + - name: Create tag |
| 39 | + run: | |
| 40 | + git config --local user.email "[email protected]" |
| 41 | + git config --local user.name "GitHub Action" |
| 42 | + git tag -a ${{ steps.version.outputs.version }} -m "Release ${{ steps.version.outputs.version }}" |
| 43 | + git push origin ${{ steps.version.outputs.version }} |
| 44 | +
|
| 45 | + build-csi: |
| 46 | + needs: release |
| 47 | + runs-on: ubuntu-latest |
| 48 | + strategy: |
| 49 | + matrix: |
| 50 | + region: |
| 51 | + - name: us-east-1 |
| 52 | + identifier: virginia |
| 53 | + - name: eu-west-2 |
| 54 | + identifier: london |
| 55 | + steps: |
| 56 | + - name: "Checkout" |
| 57 | + uses: actions/checkout@v4 |
| 58 | + |
| 59 | + - name: Configure AWS credentials |
| 60 | + uses: aws-actions/configure-aws-credentials@v4 |
| 61 | + with: |
| 62 | + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 63 | + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 64 | + aws-region: ${{ matrix.region.name }} |
| 65 | + |
| 66 | + - name: Login to ECR |
| 67 | + id: login-ecr |
| 68 | + uses: aws-actions/amazon-ecr-login@v2 |
| 69 | + |
| 70 | + - uses: depot/setup-action@v1 |
| 71 | + |
| 72 | + - name: Build and Push CSI Driver |
| 73 | + uses: depot/build-push-action@v1 |
| 74 | + with: |
| 75 | + platforms: linux/amd64,linux/arm64 |
| 76 | + file: docker/csi.Dockerfile |
| 77 | + context: "{{defaultContext}}" |
| 78 | + build-args: | |
| 79 | + JFSCHAN=stable |
| 80 | + JUICEFS_CE_MOUNT_IMAGE=juicedata/mount:ce-latest |
| 81 | + JUICEFS_EE_MOUNT_IMAGE=juicedata/mount:ee-5.2.8-1305e8c |
| 82 | + provenance: false |
| 83 | + token: ${{ secrets.DEPOT_TOKEN }} |
| 84 | + push: true |
| 85 | + tags: | |
| 86 | + ${{ steps.login-ecr.outputs.registry }}/juicefs-csi-driver-${{ matrix.region.identifier }}:${{ needs.release.outputs.version }} |
| 87 | + ${{ steps.login-ecr.outputs.registry }}/juicefs-csi-driver-${{ matrix.region.identifier }}:latest |
| 88 | +
|
| 89 | + # build-mount-images: |
| 90 | + # needs: release |
| 91 | + # runs-on: ubuntu-latest |
| 92 | + # strategy: |
| 93 | + # matrix: |
| 94 | + # region: |
| 95 | + # - name: us-east-1 |
| 96 | + # identifier: virginia |
| 97 | + # - name: eu-west-2 |
| 98 | + # identifier: london |
| 99 | + # edition: |
| 100 | + # - name: ce |
| 101 | + # dockerfile: ce.juicefs.Dockerfile |
| 102 | + # build-args: | |
| 103 | + # CEJUICEFS_VERSION=latest |
| 104 | + # - name: ee |
| 105 | + # dockerfile: ee.juicefs.Dockerfile |
| 106 | + # build-args: | |
| 107 | + # EEJUICEFS_VERSION=5.2.8-1305e8c |
| 108 | + # steps: |
| 109 | + # - name: "Checkout" |
| 110 | + # uses: actions/checkout@v4 |
| 111 | + # |
| 112 | + # - name: Configure AWS credentials |
| 113 | + # uses: aws-actions/configure-aws-credentials@v4 |
| 114 | + # with: |
| 115 | + # aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 116 | + # aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 117 | + # aws-region: ${{ matrix.region.name }} |
| 118 | + # |
| 119 | + # - name: Login to ECR |
| 120 | + # id: login-ecr |
| 121 | + # uses: aws-actions/amazon-ecr-login@v2 |
| 122 | + # |
| 123 | + # - uses: depot/setup-action@v1 |
| 124 | + # |
| 125 | + # - name: Build and Push Mount Image (${{ matrix.edition.name }}) |
| 126 | + # uses: depot/build-push-action@v1 |
| 127 | + # with: |
| 128 | + # platforms: linux/amd64,linux/arm64 |
| 129 | + # context: docker |
| 130 | + # file: docker/${{ matrix.edition.dockerfile }} |
| 131 | + # build-args: ${{ matrix.edition.build-args }} |
| 132 | + # provenance: false |
| 133 | + # token: ${{ secrets.DEPOT_TOKEN }} |
| 134 | + # push: true |
| 135 | + # tags: | |
| 136 | + # ${{ steps.login-ecr.outputs.registry }}/juicefs-mount-${{ matrix.edition.name }}-${{ matrix.region.identifier }}:${{ needs.release.outputs.version }} |
| 137 | + # ${{ steps.login-ecr.outputs.registry }}/juicefs-mount-${{ matrix.edition.name }}-${{ matrix.region.identifier }}:latest |
| 138 | + # |
| 139 | + # build-dashboard: |
| 140 | + # needs: release |
| 141 | + # runs-on: ubuntu-latest |
| 142 | + # strategy: |
| 143 | + # matrix: |
| 144 | + # region: |
| 145 | + # - name: us-east-1 |
| 146 | + # identifier: virginia |
| 147 | + # - name: eu-west-2 |
| 148 | + # identifier: london |
| 149 | + # steps: |
| 150 | + # - name: "Checkout" |
| 151 | + # uses: actions/checkout@v4 |
| 152 | + # |
| 153 | + # - uses: pnpm/action-setup@v4 |
| 154 | + # name: Install pnpm |
| 155 | + # with: |
| 156 | + # version: 9 |
| 157 | + # run_install: | |
| 158 | + # cwd: dashboard-ui-v2 |
| 159 | + # |
| 160 | + # - name: Build dashboard |
| 161 | + # run: make dashboard-dist |
| 162 | + # |
| 163 | + # - name: Configure AWS credentials |
| 164 | + # uses: aws-actions/configure-aws-credentials@v4 |
| 165 | + # with: |
| 166 | + # aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 167 | + # aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 168 | + # aws-region: ${{ matrix.region.name }} |
| 169 | + # |
| 170 | + # - name: Login to ECR |
| 171 | + # id: login-ecr |
| 172 | + # uses: aws-actions/amazon-ecr-login@v2 |
| 173 | + # |
| 174 | + # - uses: depot/setup-action@v1 |
| 175 | + # |
| 176 | + # - name: Build and Push Dashboard |
| 177 | + # uses: depot/build-push-action@v1 |
| 178 | + # with: |
| 179 | + # platforms: linux/amd64,linux/arm64 |
| 180 | + # context: . |
| 181 | + # file: docker/dashboard.Dockerfile |
| 182 | + # build-contexts: | |
| 183 | + # project=. |
| 184 | + # ui=./dashboard-ui-v2 |
| 185 | + # provenance: false |
| 186 | + # token: ${{ secrets.DEPOT_TOKEN }} |
| 187 | + # push: true |
| 188 | + # tags: | |
| 189 | + # ${{ steps.login-ecr.outputs.registry }}/juicefs-csi-dashboard-${{ matrix.region.identifier }}:${{ needs.release.outputs.version }} |
| 190 | + # ${{ steps.login-ecr.outputs.registry }}/juicefs-csi-dashboard-${{ matrix.region.identifier }}:latest |
| 191 | + |
| 192 | + notify: |
| 193 | + needs: [release, build-csi] |
| 194 | + runs-on: ubuntu-latest |
| 195 | + if: always() && needs.build-csi.result == 'success' && needs.build-mount-images.result == 'success' && needs.build-dashboard.result == 'success' |
| 196 | + steps: |
| 197 | + - name: Notify Slack! |
| 198 | + uses: someimportantcompany/github-actions-slack-message@v1 |
| 199 | + with: |
| 200 | + webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} |
| 201 | + text: ":rocket: JuiceFS CSI Driver ${{ needs.release.outputs.version }} images built and pushed to all ECR registries! :rocket:" |
0 commit comments