diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e320779..5699896 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,4 +1,4 @@ -name: quay +name: Build images on: push: @@ -15,6 +15,12 @@ jobs: uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 + - name: Login to ghcr.io + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Login to Quay uses: docker/login-action@v1 with: @@ -27,7 +33,7 @@ jobs: if: ${{ github.event.release.tag_name != '' }} with: push: true - tags: quay.io/bakito/k8s-event-logger:latest,quay.io/bakito/k8s-event-logger:${{ github.event.release.tag_name }} + tags: ghcr.io/bakito/k8s-event-logger:latest,ghcr.io/bakito/k8s-event-logger:${{ github.event.release.tag_name }},quay.io/bakito/k8s-event-logger:latest,quay.io/bakito/k8s-event-logger:${{ github.event.release.tag_name }} platforms: linux/amd64 build-args: VERSION=${{ github.event.release.tag_name }} @@ -37,8 +43,17 @@ jobs: if: ${{ github.event.release.tag_name == '' }} with: push: true - tags: quay.io/bakito/k8s-event-logger:master + tags: ghcr.io/bakito/k8s-event-logger:master,quay.io/bakito/k8s-event-logger:master platforms: linux/amd64 build-args: VERSION=master - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} + + - name: Prune ghcr images + uses: vlaurin/action-ghcr-prune@main + with: + token: ${{ secrets.PRUNE_IMAGE_TOKEN }} + container: sealed-secrets-web + dry-run: false # Dry-run first, then change to `false` + older-than: 7 # days + untagged: true \ No newline at end of file diff --git a/.github/workflows/upload-helm-chart.yml b/.github/workflows/upload-helm-chart.yml new file mode 100644 index 0000000..47bdb7f --- /dev/null +++ b/.github/workflows/upload-helm-chart.yml @@ -0,0 +1,45 @@ +name: Upload Helm Chart + +on: + release: + types: + - published + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + - name: Install Helm + uses: azure/setup-helm@v1 + + - name: Build chart + run: | + VERSION=$(echo "${{github.event.release.tag_name }}" | sed 's/v//g') + helm package ./helm/ --version $VERSION --app-version v$VERSION -d dist + + - name: Install chart-releaser + uses: engineerd/configurator@v0.0.8 + with: + name: cr + url: https://github.com/helm/chart-releaser/releases/download/v1.2.1/chart-releaser_1.2.1_linux_amd64.tar.gz + pathInArchive: cr + + - name: Upload Chart + run: cr upload + env: + CR_OWNER: "${{github.repository_owner}}" + CR_TOKEN: "${{secrets.CR_TOKEN}}" + CR_GIT_REPO: "helm-charts" + CR_PACKAGE_PATH: dist diff --git a/.goreleaser.yml b/.goreleaser.yml index 9c0199e..4a08588 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,6 +1,3 @@ -before: - hooks: - - rm -f k8s-event-logger-operator-*.tgz && helm package ./helm/ --version {{ .Version }} --app-version v{{ .Version }} builds: - skip: true main: ./main.go @@ -10,9 +7,6 @@ checksum: name_template: 'checksums.txt' snapshot: name_template: "{{ .Tag }}-next" -release: - extra_files: - - glob: ./k8s-event-logger-operator-*.tgz changelog: sort: asc filters: diff --git a/Makefile b/Makefile index 7948f09..aee2032 100644 --- a/Makefile +++ b/Makefile @@ -69,6 +69,8 @@ docker-push: .PHONY: release release: goreleaser + @version=$$(semver); \ + git tag -s $$version -m"Release $$version" $(GORELEASER) --rm-dist .PHONY: test-release diff --git a/helm/values.yaml b/helm/values.yaml index b7640c4..709a451 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -3,7 +3,7 @@ # Declare variables to be passed into your templates. image: - repository: quay.io/bakito/k8s-event-logger + repository: ghcr.io/bakito/k8s-event-logger pullPolicy: Always eventLogger: