Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
263 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Continuous Deployment | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'release' | ||
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GIT_EMAIL: ${{ secrets.GIT_EMAIL }} | ||
|
||
jobs: | ||
build: | ||
name: Build and deploy app | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Read .nvmrc | ||
id: nvmrc | ||
run: echo "::set-output name=node::$(cat .nvmrc)" | ||
|
||
- name: Use Node.js ${{ steps.nvmrc.outputs.node }} | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ steps.nvmrc.outputs.node }} | ||
|
||
- name: Read npm cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.npm | ||
key: node-cache-${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
node-cache-${{ runner.os }}-npm- | ||
- name: Install packages | ||
run: npm ci | ||
|
||
- name: Lint | ||
run: npm run lint | ||
|
||
- name: Build | ||
run: npx semantic-release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"branches": ["release"], | ||
"plugins": [ | ||
[ | ||
"@semantic-release/commit-analyzer", | ||
{ | ||
"releaseRules": [ | ||
{ | ||
"type": "chore", | ||
"release": "patch" | ||
} | ||
] | ||
} | ||
], | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/changelog", | ||
"@semantic-release/npm", | ||
"@semantic-release/git", | ||
[ | ||
"@semantic-release/exec", | ||
{ | ||
"prepareCmd": "./tools/package-google-cloud-sql.sh ${nextRelease.version}" | ||
} | ||
], | ||
[ | ||
"@semantic-release/github", | ||
{ | ||
"assets": [ | ||
{ | ||
"path": "bin/google-cloud-sql-linux.tar.gz", | ||
"name": "google-cloud-sql-linux-${nextRelease.version}.tar.gz", | ||
"label": "Linux distribution" | ||
}, | ||
{ | ||
"path": "bin/google-cloud-sql-macos.tar.gz", | ||
"name": "google-cloud-sql-macos-${nextRelease.version}.tar.gz", | ||
"label": "MacOS distribution" | ||
}, | ||
{ | ||
"path": "bin/google-cloud-sql-win.tar.gz", | ||
"name": "google-cloud-sql-win-${nextRelease.version}.tar.gz", | ||
"label": "Windows distribution" | ||
} | ||
] | ||
} | ||
], | ||
[ | ||
"@semantic-release/exec", | ||
{ | ||
"prepareCmd": "./tools/publish-brew-formula.sh ${nextRelease.version}" | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
version="$1" | ||
|
||
npx replace-in-file '0.0.0-dev' "$version" ./src/lib/version.ts | ||
npm run bundle | ||
|
||
cd bin | ||
tar --transform s/-linux// -czf "google-cloud-sql-linux.tar.gz" google-cloud-sql-linux | ||
tar --transform s/-macos// -czf "google-cloud-sql-macos.tar.gz" google-cloud-sql-macos | ||
tar --transform s/-win// -czf "google-cloud-sql-win.tar.gz" google-cloud-sql-win.exe | ||
cd .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env bash | ||
|
||
version="$1" | ||
url="https://github.com/edosrecki/google-cloud-sql-cli/releases/download/v$version/google-cloud-sql-macos-$version.tar.gz" | ||
checksum=$(shasum -a 256 bin/google-cloud-sql-macos.tar.gz | awk '{ print $1 }') | ||
|
||
git clone "https://${GITHUB_TOKEN}@github.com/edosrecki/homebrew-tools.git" | ||
cd homebrew-tools | ||
|
||
git config user.email "${GIT_EMAIL}" | ||
git config user.name "Dinko Osrecki" | ||
|
||
cat <<EOF > google-cloud-sql.rb | ||
class GoogleCloudSql < Formula | ||
desc "" | ||
homepage "https://github.com/edosrecki/google-cloud-sql-cli" | ||
url "$url" | ||
sha256 "$checksum" | ||
bottle :unneeded | ||
def install | ||
bin.install "google-cloud-sql" | ||
end | ||
test do | ||
system "#{bin}/google-cloud-sql", "--version" | ||
end | ||
end | ||
EOF | ||
|
||
git add google-cloud-sql.rb | ||
git commit -m "chore: release google-cloud-sql v$version" | ||
git push | ||
|
||
cd .. | ||
rm -rf homebrew-tools |