diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..f58e85b --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,134 @@ +--- +name: Publish + +on: + push: + branches: + - master + tags: + - 'v*.*.*' + +jobs: + publish: + name: Build and push osbuilder image + runs-on: ubuntu-22.04 + permissions: + contents: 'read' + id-token: 'write' + packages: 'write' + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ghcr.io/pluralsh/osbuilder + docker.io/pluralsh/osbuilder + tags: | + type=sha + type=semver,pattern={{version}} + type=raw,value=latest,enable={{is_default_branch}} + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Login to Docker + uses: docker/login-action@v3 + with: + username: mjgpluralsh + password: ${{ secrets.DOCKER_ACCESS_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: "." + file: "./Dockerfile" + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64 + cache-from: type=gha + cache-to: type=gha,mode=max + build-args: | + GIT_COMMIT=${{ github.sha }} + release: + name: Create GitHub release + runs-on: ubuntu-22.04 + needs: publish + permissions: + contents: write + discussions: write + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Release + uses: softprops/action-gh-release@v1 + with: + generate_release_notes: true + draft: false + bump: + name: Bump Chart Version + runs-on: ubuntu-22.04 + needs: [release] + permissions: + contents: write + discussions: write + pull-requests: write + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + persist-credentials: false + fetch-depth: 0 # otherwise, you will failed to push refs to dest repo + - uses: actions/setup-go@v5.2.0 + with: + go-version: "^1.21.3" + # - name: update controller crds + # working-directory: controller + # run: make chart-crds + # - name: update controller rbac + # working-directory: controller + # run: make chart-rbac + - name: push byok chart + uses: pluralsh/chart-releaser@v0.1.3 + with: + path: ./charts/console + release: ${{github.ref_name}} + - name: push controller chart + uses: pluralsh/chart-releaser@v0.1.3 + with: + path: ./charts/controller + release: ${{github.ref_name}} + - name: controller version + id: controller_vsn + uses: mikefarah/yq@master + with: + cmd: yq ".version" charts/controller/Chart.yaml + - name: update byok + uses: mikefarah/yq@master + with: + cmd: yq -i '.dependencies[] |= select(.name == "controller").version="${{ steps.controller_vsn.outputs.result }}"' charts/console/Chart.yaml + - name: update byok + uses: mikefarah/yq@master + with: + cmd: yq -i '.dependencies[] |= select(.name == "controller").version="${{ steps.controller_vsn.outputs.result }}"' plural/helm/console/Chart.yaml + - name: helm-dependencies + run: make helm-dependencies + - name: copy crds to plural chart + run: cp -a charts/controller/crds plural/helm/console + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + title: Release ${{github.ref_name}} + body: Automated Pull Request to release ${{github.ref_name}} + commit-message: Updated chart to release ${{github.ref_name}} + branch: release-${{github.ref_name}} + labels: release + base: master \ No newline at end of file diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml deleted file mode 100644 index 1b2bcd4..0000000 --- a/.github/workflows/image.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -name: 'build container images' - -on: - push: - branches: - - master - tags: - - 'v*.*.*' - -jobs: - publish-osbuilder: - name: Build and push osbuilder image - runs-on: ubuntu-22.04 - permissions: - contents: 'read' - id-token: 'write' - packages: 'write' - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: | - ghcr.io/pluralsh/osbuilder - docker.io/pluralsh/osbuilder - tags: | - type=sha - type=match,pattern=bundle/v(.*),group=1 - type=raw,value=latest,enable={{is_default_branch}} - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to GHCR - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Login to Docker - uses: docker/login-action@v3 - with: - username: mjgpluralsh - password: ${{ secrets.DOCKER_ACCESS_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v6 - with: - context: "." - file: "./Dockerfile" - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - platforms: linux/amd64,linux/arm64 - cache-from: type=gha - cache-to: type=gha,mode=max - build-args: | - GIT_COMMIT=${{ github.sha }}