From cf64429d09a321faf63a120d5d92d5af7d18de2b Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Thu, 4 May 2023 14:35:45 -0700 Subject: [PATCH] Remove outdatated workflow files --- .github/workflows/draft-release.yaml | 138 --------------------------- .github/workflows/release.yml | 57 ----------- 2 files changed, 195 deletions(-) delete mode 100644 .github/workflows/draft-release.yaml delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/draft-release.yaml b/.github/workflows/draft-release.yaml deleted file mode 100644 index 4a27bdb767..0000000000 --- a/.github/workflows/draft-release.yaml +++ /dev/null @@ -1,138 +0,0 @@ -name: Create Draft Release - -on: - push: - branches: - - release-* - workflow_dispatch: - inputs: - tagFrom: - description: The tag to create the release from. - required: true - type: string - tagTo: - description: The tag to create the release to. - required: true - type: string - branch: - description: The branch where the release will be created. - required: true - type: string - -jobs: - - binary: - name: Create Draft Release - runs-on: ubuntu-22.04 - steps: - - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 - - run: npm install semver - - uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0 - continue-on-error: true - with: - script: | - const semver = require('semver'); - const ref = context.ref.split("/")[2] - - const releases = (await github.rest.repos.listReleases({ - owner: context.payload.repository.owner.login, - repo: context.payload.repository.name, - per_page: 100, - })).data - - let latest_release - const latest_release_current_branch = releases.find(release => !release.draft && release.tag_name.startsWith("v" + ref.split("-")[1])) - - if (latest_release_current_branch === undefined){ - latest_release = (await github.rest.repos.getLatestRelease({ - owner: context.payload.repository.owner.login, - repo: context.payload.repository.name, - })).data.tag_name - } else { - latest_release = latest_release_current_branch.tag_name - } - - let tagFrom, tagTo, branch - if (context.eventName === 'workflow_dispatch'){ - console.log(`Dispatch run with inputs: ${JSON.stringify(context.payload.inputs)}`) - ;({ tagFrom, tagTo, branch } = context.payload.inputs) - } else { - ;({ tagFrom, tagTo, branch } = { - tagFrom: latest_release, - tagTo: 'next', - branch: ref, - }) - console.log(`Push run with: { tagFrom: ${tagFrom}, tagTo: ${tagTo}, branch: ${branch} }`) - } - console.log(`The latest release was ${tagFrom}`) - - let version = tagTo.replace('v', '') - if (version === 'next'){ - const temp_notes = (await github.rest.repos.generateReleaseNotes({ - owner: context.payload.repository.owner.login, - repo: context.payload.repository.name, - tag_name: tagTo, - previous_tag_name: tagFrom, - target_commitish: branch, - })).data.body - - let level - temp_notes.includes("### 🚀 Features") ? level = 'minor' : level = 'patch' - temp_notes.includes("### 💣 Breaking Changes") ? level = 'major' : level = level - version = semver.inc(tagFrom, level) - console.log(`The level of the release is ${level}`) - } - const draft = releases.find((r) => r.draft && r.tag_name === "v"+version) - const draft_found = !(draft === undefined) - - console.log(`The next version is v${version}`) - - const footer = ` - ## Upgrade - - For NGINX, use the v${version} image from our [DockerHub](https://hub.docker.com/r/nginx/nginx-ingress/tags?page=1&ordering=last_updated&name=${version}), [GitHub Container](https://github.com/nginxinc/kubernetes-ingress/pkgs/container/kubernetes-ingress), [Amazon ECR Public Gallery](https://gallery.ecr.aws/nginx/nginx-ingress) or [Quay.io](https://quay.io/repository/nginx/nginx-ingress). - - For NGINX Plus, use the v${version} image from the F5 Container registry or the [AWS Marketplace](https://aws.amazon.com/marketplace/search/?CREATOR=741df81b-dfdc-4d36-b8da-945ea66b522c&FULFILLMENT_OPTION_TYPE=CONTAINER&filters=CREATOR%2CFULFILLMENT_OPTION_TYPE) or build your own image using the v${version} source code. - - For Helm, use version %HELM_CHART_VERSION% of the chart. - - ## Resources - - Documentation -- https://docs.nginx.com/nginx-ingress-controller/ - - Configuration examples -- https://github.com/nginxinc/kubernetes-ingress/tree/v${version}/examples - - Helm Chart -- https://github.com/nginxinc/kubernetes-ingress/tree/v${version}/deployments/helm-chart - - Operator -- https://github.com/nginxinc/nginx-ingress-operator/ - ` - - const release_notes = (await github.rest.repos.generateReleaseNotes({ - owner: context.payload.repository.owner.login, - repo: context.payload.repository.name, - tag_name: 'v' + version, - previous_tag_name: tagFrom, - target_commitish: branch, - })) - - let release - if (draft_found){ - console.log("Draft found") - release = (await github.rest.repos.updateRelease({ - owner: context.payload.repository.owner.login, - repo: context.payload.repository.name, - release_id: draft.id, - tag_name: 'v' + version, - target_commitish: branch, - name: 'v' + version, - body: release_notes.data.body + footer, - draft: true, - })) - } else { - console.log("Draft not found") - release = (await github.rest.repos.createRelease({ - owner: context.payload.repository.owner.login, - repo: context.payload.repository.name, - tag_name: 'v' + version, - target_commitish: ref, - name: 'v' + version, - body: release_notes.data.body + footer, - draft: true, - })) - } - - console.log(`Release created: ${release.data.html_url}`) - console.log(`Release notes: ${release_notes.data.body}`) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 3a042ecc58..0000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Publish Release - -on: - workflow_call: - -defaults: - run: - shell: bash - -jobs: - release: - runs-on: ubuntu-22.04 - steps: - - name: Checkout Repository - uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0 - - - uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 - - run: npm install js-yaml - continue-on-error: true - - - name: Publish release on tag - uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0 - continue-on-error: true - with: - retries: 3 - script: | - const ref = context.ref.split("/")[2] - const yaml = require('js-yaml'); - - const releases = (await github.rest.repos.listReleases({ - owner: context.payload.repository.owner.login, - repo: context.payload.repository.name, - per_page: 100, - })).data - - const draft_release = releases.find(release => release.draft && release.tag_name === ref) - - const helm_file = (await github.rest.repos.getContent({ - owner: context.payload.repository.owner.login, - repo: context.payload.repository.name, - path: "deployments/helm-chart/Chart.yaml", - ref: ref, - })).data.content - - const helm_yaml = yaml.load(Buffer.from(helm_file, 'base64').toString()) - const helm_version = helm_yaml.version - console.log(`Helm version: ${helm_version}`) - - const update = await github.rest.repos.updateRelease({ - owner: context.payload.repository.owner.login, - repo: context.payload.repository.name, - release_id: draft_release.id, - body: draft_release.body.replace("%HELM_CHART_VERSION%", helm_version), - draft: false - }); - console.log(`Release published: ${update.data.html_url}`) - console.log(`Release notes: ${update.data.body}`)