-
Notifications
You must be signed in to change notification settings - Fork 9
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
1 parent
3060526
commit e2653ae
Showing
3 changed files
with
101 additions
and
0 deletions.
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,36 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: setup go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ^1.18 | ||
|
||
- name: login to github docker registry | ||
uses: docker/login-action@v1.14.1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: publish docker image to registry | ||
env: | ||
COMMIT_SHA: ${{ github.sha }} | ||
REPO_REGISTRY: ghcr.io/${{ github.repository_owner }}/batnoter | ||
run: | | ||
docker build \ | ||
-t $REPO_REGISTRY/${GITHUB_REPOSITORY#*/}:${GITHUB_REF##*/} \ | ||
-t $REPO_REGISTRY/${GITHUB_REPOSITORY#*/}:$COMMIT_SHA \ | ||
-t $REPO_REGISTRY/${GITHUB_REPOSITORY#*/}:latest . | ||
docker push -a $REPO_REGISTRY/${GITHUB_REPOSITORY#*/} |
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,38 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
|
||
deploy: | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: Production | ||
url: 'https://batnoter.com' | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: setup go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ^1.18 | ||
|
||
- name: login to heroku docker registry | ||
uses: docker/login-action@v1.14.1 | ||
with: | ||
registry: registry.heroku.com | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.HEROKU_API_KEY }} | ||
|
||
- name: deploy to heroku | ||
env: | ||
HEROKU_APP_NAME: batnoter | ||
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} | ||
run: | | ||
heroku container:push web -a $HEROKU_APP_NAME | ||
heroku container:release web -a $HEROKU_APP_NAME | ||
heroku releases --json -n 1 -a $HEROKU_APP_NAME | grep '"succeeded"' |
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,27 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
# Note: GitHub does not pass secrets(for security reasons) to PR workflows created with forked repos | ||
# So do not use any actions that require secrets | ||
# Tee GITHUB_TOKEN secret is allowed with readonly access for PR workflows created with forked repos | ||
|
||
jobs: | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: setup go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ^1.18 | ||
|
||
- name: run tests | ||
run: go test -v -race -coverprofile=coverage.out -coverpkg=./internal/... -covermode=atomic ./internal/... | ||
|
||
- name: upload coverage to codecov | ||
uses: codecov/codecov-action@v2 |