Skip to content

Commit

Permalink
Merge pull request #139 from shift72/release-it
Browse files Browse the repository at this point in the history
Release it
  • Loading branch information
Jonecon authored Apr 24, 2024
2 parents f49a177 + 1c89e67 commit 4b5cdda
Show file tree
Hide file tree
Showing 12 changed files with 5,410 additions and 50 deletions.
61 changes: 51 additions & 10 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,36 @@ run-name: Build and deploy ${{github.ref_name}}

on:
workflow_dispatch:
# release:
# types: [created]
release:
types: [created]

jobs:
sanity-checks:
name: Prerelease sanity checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '16.x'
- name: Ensure kibble-npm package version matches the tag
env:
WORKFLOW_REF: ${{github.ref_name}}
run: |
cd kibble-npm
NPM_PACKAGE_VERSION=`node -p 'require("./package.json").version'`
if [ "$NPM_PACKAGE_VERSION" != "$WORKFLOW_REF" ]; then
echo "::error file=kibble-npm/package.json,title=NPM package version mismatch::Cannot publish as the package version is $NPM_PACKAGE_VERSION but the workflow tag is $WORKFLOW_REF"
exit 1
fi
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.17
go-version: 1.18
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
Expand All @@ -33,14 +52,14 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.17
go-version: 1.18
- name: Run tests
working-directory: ./kibble
run: make test

release:
name: Release
needs: [lint, test]
needs: [sanity-checks, lint, test]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -50,14 +69,36 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.17
go-version: 1.18
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
version: v1.10.3
install-only: true
- run: make release
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# TODO: AWS creds for pushing to the s3 bucket here too!
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ vars.KIBBLE_DEPLOY_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.KIBBLE_DEPLOY_AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ap-southeast-2

publish-npm:
name: Publish to NPM
needs: [release]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: "https://registry.npmjs.org"
- name: Install deps
working-directory: kibble-npm
run: npm ci
- name: Publish wrapper package to npm
working-directory: kibble-npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ kibble/sample_site/.kibble
kibble/vendor
kibble/dist
kibble-npm/node_modules
node_modules
s72-kibble-*
kibble-windows-amd64.exe
.vs
unpacked_bin
.DS_Store
.DS_Store
26 changes: 26 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"git": {
"commitMessage": "Release: ${version}",
"tagName": "${version}"
},
"github": {
"release": true,
"draft": true,
"web": true,
"releaseName": "${version}"
},

"npm": false,

"hooks": {
"after:bump": "cd kibble-npm && npm version ${version}"
},

"plugins": {
"@release-it/keep-a-changelog": {
"filename": "changelog.md",
"strictLatest": false,
"addUnreleased": true
}
}
}
19 changes: 10 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@ LINUXarm64 := "s72-web/kibble/$(VERSION)/kibble_$(VERSION)_Tux_arm64-bit.tar.gz"
WINDOWSx64 := "s72-web/kibble/$(VERSION)/kibble_$(VERSION)_windows_64-bit.zip"
WINDOWSarm64 := "s72-web/kibble/$(VERSION)/kibble_$(VERSION)_windows_arm64-bit.zip"

release_with_profile: AWS_PROFILE=shift72a release

release:
cd kibble && AWS_PROFILE=shift72a goreleaser --rm-dist
cd kibble && goreleaser --rm-dist

echo "setting acls for the released versions"
aws s3api put-object-acl --bucket shift72-sites --key $(DARWINx64) --acl public-read --profile shift72a
aws s3api put-object-acl --bucket shift72-sites --key $(DARWINarm64) --acl public-read --profile shift72a
aws s3api put-object-acl --bucket shift72-sites --key $(LINUXx64) --acl public-read --profile shift72a
aws s3api put-object-acl --bucket shift72-sites --key $(LINUXarm64) --acl public-read --profile shift72a
aws s3api put-object-acl --bucket shift72-sites --key $(WINDOWSx64) --acl public-read --profile shift72a
aws s3api put-object-acl --bucket shift72-sites --key $(WINDOWSarm64) --acl public-read --profile shift72a

cd kibble-npm && npm publish
aws s3api put-object-acl --bucket shift72-sites --key $(DARWINx64) --acl public-read
aws s3api put-object-acl --bucket shift72-sites --key $(DARWINarm64) --acl public-read
aws s3api put-object-acl --bucket shift72-sites --key $(LINUXx64) --acl public-read
aws s3api put-object-acl --bucket shift72-sites --key $(LINUXarm64) --acl public-read
aws s3api put-object-acl --bucket shift72-sites --key $(WINDOWSx64) --acl public-read
aws s3api put-object-acl --bucket shift72-sites --key $(WINDOWSarm64) --acl public-read
aws s3 cp ./kibble/dist/kibble_linux_amd64_v1/kibble s3://shift72-sites/builder/$(VERSION)/kibble

update_s3:
echo "setting acls for the released versions"
Expand Down
12 changes: 9 additions & 3 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# Change log

## Unreleased
## [Unreleased]

## [0.17.5] - 2024-04-24
- Stable release it deploys

## [0.17.5-0] - 2024-04-24

### Added
- Carousel Focus to film / tv models.
- release-it: smoother automated releases
- Carousel Focus to film / tv models.

## 0.17.4
## [0.17.4] - 2024-02-27

### Changed
- Fix build support for arm64
Expand Down
4 changes: 2 additions & 2 deletions kibble-npm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions kibble-npm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "s72-kibble",
"version": "0.17.4",
"version": "0.17.5",
"description": "SHIFT72 static site generator",
"preferGlobal": false,
"main": "index.js",
Expand All @@ -26,4 +26,4 @@
"dependencies": {
"binwrap": "^0.2.0"
}
}
}
2 changes: 0 additions & 2 deletions kibble/.goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ builds:
- amd64
- arm64
ldflags: -s -w -X kibble/version.Version={{.Version}}
hooks:
post: sh ./deploy_aws.sh {{.Version}} {{.Os}}

archives:
- id: main
Expand Down
2 changes: 1 addition & 1 deletion kibble/deploy_aws.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ if [ $OS != "linux" ]; then
fi

echo "uploading linux only version - $VERSION"
aws s3 cp ./dist/kibble_linux_amd64_v1/kibble s3://shift72-sites/builder/$VERSION/kibble --profile shift72a
aws s3 cp ./dist/kibble_linux_amd64_v1/kibble s3://shift72-sites/builder/$VERSION/kibble --debug --profile shift72a
Loading

0 comments on commit 4b5cdda

Please sign in to comment.