Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
439c4cc
Added release branch workflow
dhurley Aug 25, 2022
624111f
Added release branch workflow
dhurley Aug 25, 2022
1a61e8f
Updating changelog
github-actions[bot] Aug 25, 2022
15330ad
Added release branch workflow
dhurley Aug 25, 2022
7b69b2e
Updating changelog
github-actions[bot] Aug 25, 2022
4ab87db
Added release branch workflow
dhurley Aug 25, 2022
d7fe53a
Updating changelog
github-actions[bot] Aug 25, 2022
9bd360d
Added release branch workflow
dhurley Aug 25, 2022
45b469d
Updating changelog
github-actions[bot] Aug 25, 2022
1c4b145
Added release branch workflow
dhurley Aug 25, 2022
71e7e8b
Updating changelog
github-actions[bot] Aug 25, 2022
e52688d
Added release branch workflow
dhurley Aug 25, 2022
e95b369
Updating changelog
github-actions[bot] Aug 25, 2022
e4eb304
Added release branch workflow
dhurley Aug 25, 2022
6ebd430
Updating changelog
github-actions[bot] Aug 25, 2022
114d6ea
Added release branch workflow
dhurley Aug 25, 2022
f9d0846
Updating changelog
github-actions[bot] Aug 25, 2022
9d2fdbc
Added release branch workflow
dhurley Aug 25, 2022
8fdf407
Updating changelog
github-actions[bot] Aug 25, 2022
a4529ec
Added release branch workflow
dhurley Aug 25, 2022
6c00e85
Updating changelog
github-actions[bot] Aug 25, 2022
59620c3
Added release branch workflow
dhurley Aug 25, 2022
5a19dc6
Updating changelog
github-actions[bot] Aug 25, 2022
5638b1b
Added release branch workflow
dhurley Aug 26, 2022
7dd6e90
Updating changelog
github-actions[bot] Aug 26, 2022
c520852
Added release branch workflow
dhurley Aug 26, 2022
8faedb9
Updating changelog
github-actions[bot] Aug 26, 2022
20e74d7
Added release branch workflow
dhurley Aug 26, 2022
161fbec
Updating changelog
github-actions[bot] Aug 26, 2022
f9dd67c
Added release branch workflow
dhurley Aug 26, 2022
8bec0e2
Updating changelog
github-actions[bot] Aug 26, 2022
d7012fe
Added release branch workflow
dhurley Aug 26, 2022
2192790
Updating changelog
github-actions[bot] Aug 26, 2022
fd4848a
Added release branch workflow
dhurley Aug 26, 2022
e6d31ff
Updating changelog
github-actions[bot] Aug 26, 2022
15986d6
Added release branch workflow
dhurley Aug 26, 2022
b5ea18c
Updating changelog
github-actions[bot] Aug 26, 2022
6884b23
Added release branch workflow
dhurley Aug 26, 2022
72c659c
Updating changelog
github-actions[bot] Aug 26, 2022
4d0d6f9
Added release branch workflow
dhurley Aug 26, 2022
b3d952a
Updating changelog
github-actions[bot] Aug 26, 2022
3874856
Added release branch workflow
dhurley Aug 26, 2022
c982fe0
Updating changelog
github-actions[bot] Aug 26, 2022
6822f5c
Added release branch workflow
dhurley Aug 26, 2022
c471f40
Updating changelog
github-actions[bot] Aug 26, 2022
67d5648
Added release branch workflow
dhurley Aug 26, 2022
710e7e1
Updating changelog
github-actions[bot] Aug 26, 2022
233e70a
Added release branch workflow
dhurley Aug 26, 2022
175546d
Updating changelog
github-actions[bot] Aug 26, 2022
d6b7095
Added release branch workflow
dhurley Aug 26, 2022
f5a8664
Updating changelog
github-actions[bot] Aug 26, 2022
6488dc2
Added release branch workflow
dhurley Aug 26, 2022
0a54791
Updating changelog
github-actions[bot] Aug 26, 2022
5ad59fb
Added release branch workflow
dhurley Aug 26, 2022
e0e0f6d
Updating changelog
github-actions[bot] Aug 26, 2022
321c8f6
update packaging
aphralG Aug 26, 2022
173b0e2
Updating changelog
github-actions[bot] Aug 26, 2022
7d1c2d4
update packaging
aphralG Aug 26, 2022
78a33f0
Updating changelog
github-actions[bot] Aug 26, 2022
c9136cf
update packaging
aphralG Aug 29, 2022
99aae10
Updating changelog
github-actions[bot] Aug 29, 2022
8d6be2d
update packaging
aphralG Aug 29, 2022
3e5efdb
Updating changelog
github-actions[bot] Aug 29, 2022
d52123f
Rename pkg to txz
dhurley Aug 31, 2022
8534e36
Updating changelog
github-actions[bot] Aug 31, 2022
b1c2015
Rename pkg to txz
dhurley Aug 31, 2022
60ff650
Updating changelog
github-actions[bot] Aug 31, 2022
66e10ef
Updated release branch workflow to publish release
dhurley Sep 1, 2022
67175e1
Updating changelog
github-actions[bot] Sep 1, 2022
2bbe94a
Updated release branch workflow to publish release
dhurley Sep 1, 2022
21ced15
Updating changelog
github-actions[bot] Sep 1, 2022
32f68d2
Updated release branch workflow to publish release
dhurley Sep 1, 2022
e0efd26
Updating changelog
github-actions[bot] Sep 1, 2022
2eb4276
Updated release branch workflow to publish release
dhurley Sep 1, 2022
cfcba99
Updating changelog
github-actions[bot] Sep 1, 2022
3a32f73
Updated release branch workflow to publish release
dhurley Sep 1, 2022
52fc90c
Updating changelog
github-actions[bot] Sep 1, 2022
a46d85e
Updated release branch workflow to publish release
dhurley Sep 1, 2022
df1eb35
Updating changelog
github-actions[bot] Sep 1, 2022
9355667
Updated release branch workflow to publish release
dhurley Sep 1, 2022
a1570a4
Merge branch 'main' into add-release-branch-workflow
dhurley Sep 2, 2022
82cf5ae
Make sure CI workflow passes before running release workflow
dhurley Sep 2, 2022
0efb4a8
Clean up
dhurley Sep 2, 2022
a8ca716
Fix CI workflow
dhurley Sep 2, 2022
6e1b7a7
Fix packaging
dhurley Sep 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: CI

on:
push:
branches-ignore:
- 'release-*'

env:
GOLANGCI_LINT_VERSION: 'v1.46.2'
Expand Down Expand Up @@ -91,20 +89,22 @@ jobs:
uses: docker/build-push-action@v3
with:
file: scripts/packages/packager/Dockerfile
tags: build-packager:1.0.0
tags: build-local-packager:1.0.0
context: '.'
push: false
load: true
no-cache: true
build-args: |
package_type=local-package
- name: Build Packages
# TODO: Remove git config step later once the repo https://github.com/nginxinc/crossplane-go is made public
env:
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
git config --global url."https://dhurley:${TOKEN}@github.com".insteadOf "https://github.com"
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }}
make clean local-apk-package local-deb-package local-rpm-package local-pkg-package
tar -cf ./build/snapshots.tar.gz ./build/*.deb ./build/*.rpm ./build/*.pkg ./build/*.apk
make clean local-apk-package local-deb-package local-rpm-package local-txz-package
tar -cf ./build/snapshots.tar.gz ./build/*.deb ./build/*.rpm ./build/*.txz ./build/*.apk
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
Expand Down
206 changes: 206 additions & 0 deletions .github/workflows/release-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
name: Release Branch

on:
workflow_dispatch:
inputs:
publishPackages:
description: 'Publish packages to up-ap.nginx.com'
required: true
type: boolean
default: false
workflow_run:
branches: [release-*]
workflows: [CI]
types:
- completed

jobs:
update-draft:
name: Update Release
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- uses: actions/setup-node@v3
- run: npm install semver
- name: Create Draft Release
uses: actions/github-script@v6
id: release
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
}
console.log(`The latest release was ${latest_release}`)
const temp_notes = (await github.rest.repos.generateReleaseNotes({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
tag_name: "next",
previous_tag_name: latest_release,
target_commitish: ref,
})).data.body
let level
temp_notes.includes("### 🚀 Features") ? level = 'minor' : level = 'patch'
temp_notes.includes("### 💣 Breaking Changes") ? level = 'major' : level = level
const version = semver.inc(latest_release, 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 = `
## Resources
- Documentation -- https://docs.nginx.com/nginx-instance-manager/nginx-agent/
- Upgrade Steps -- https://docs.nginx.com/nginx-instance-manager/installation/upgrade-guide/#upgrade-nginx-agent
`
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: latest_release,
target_commitish: ref,
}))
let release
if (draft_found){
console.log("Draft release already exists. Deleting current draft release and recreating it")
release = (await github.rest.repos.deleteRelease({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
release_id: draft.id,
}))
}
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 ID: ${release.data.id}`)
console.log(`Release notes: ${release_notes.data.body}`)
console.log(`Release Upload URL: ${release.data.upload_url}`)

return {
version: version,
release_id: release.data.id,
release_upload_url: release.data.upload_url,
}
- name: Set Environment Variables
run: |
echo "${{steps.release.outputs.result}}"
echo "VERSION=$(echo '${{steps.release.outputs.result}}' | jq -r '.version')" >> $GITHUB_ENV
echo "RELEASE_ID=$(echo '${{steps.release.outputs.result}}' | jq -r '.release_id')" >> $GITHUB_ENV
echo "RELEASE_UPLOAD_URL=$(echo '${{steps.release.outputs.result}}' | jq -r '.release_upload_url')" >> $GITHUB_ENV
- name: Setup build environment
run: |
sudo apt-get update
sudo apt-get install -y gpgv1 monkeysphere
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v2.18.0
go install github.com/goreleaser/chglog/cmd/chglog@v0.2.0
- name: Tag release and update changelog
# TODO: Remove git config step later once the repo https://github.com/nginxinc/crossplane-go is made public
env:
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
PUBLISH_PACKAGE: ${{ inputs.publishPackages }}
run: |
git config --global url."https://dhurley:${TOKEN}@github.com".insteadOf "https://github.com"
git config --global user.name 'github-actions'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'

git tag -a "v${{env.VERSION}}" -m "CI Autogenerated"
git tag -a "sdk/v${{env.VERSION}}" -m "CI Autogenerated"

chglog init -o ./scripts/changelog.yml .
chglog format -i ./scripts/changelog.yml --template repo > ./docs/CHANGELOG.md
git commit -am "Updating changelog"
git push

if [[ -z "${PUBLISH_PACKAGE}" ]] && ${PUBLISH_PACKAGE}='true'; then
git push origin "v${{env.VERSION}}"
git push origin "sdk/v${{env.VERSION}}"
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build Docker Image
uses: docker/build-push-action@v3
with:
file: scripts/packages/packager/Dockerfile
tags: build-signed-packager:1.0.0
context: '.'
push: false
load: true
no-cache: true
build-args: |
package_type=signed-package
- name: Build Packages
env:
INDIGO_GPG_AGENT: ${{ secrets.INDIGO_GPG_AGENT }}
NFPM_SIGNING_KEY_FILE: .key.asc
run: |
echo $INDIGO_GPG_AGENT | base64 --decode > .key.asc
make clean build package
- name: Upload Release Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.RELEASE_UPLOAD_URL }}
asset_path: ./build/packages/nginx-agent.tar.gz
asset_name: nginx-agent.tar.gz
asset_content_type: application/zip
- name: Publish Release Packages
if: ${{ inputs.publishPackages == 'true' }}
env:
AGENT_UPLOADER_PEM: ${{ secrets.AGENT_UPLOADER_PEM }}
run: |
echo $AGENT_UPLOADER_PEM | base64 --decode > agent-uploader.pem
make release
- name: Publish Github Release
if: ${{ inputs.publishPackages == 'true' }}
uses: actions/github-script@v6
with:
script: |
const {RELEASE_ID} = process.env
const release = (await github.rest.repos.updateRelease({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
release_id: `${RELEASE_ID}`,
draft: false,
}))
console.log(`Release published: ${release.data.html_url}`)
- name: Create Pull Request
if: ${{ inputs.publishPackages == 'true' }}
uses: actions/github-script@v6
with:
script: |
const { repo, owner } = context.repo;
const result = await github.rest.pulls.create({
title: 'Merge ${{ github.event.inputs.branch }} back into main',
owner,
repo,
head: '${{ github.ref_name }}',
base: 'main',
body: [
'This PR is auto-generated by the release branch workflow.'
].join('\n')
});
47 changes: 0 additions & 47 deletions .github/workflows/release.yml

This file was deleted.

1 change: 1 addition & 0 deletions .nfpm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ overrides:
- apt-transport-https
deb:
signature:
method: dpkg-sig
key_file: ".key.asc"
rpm:
signature:
Expand Down
Loading