generated from ydataai/go-template
-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit f3c6372
Showing
17 changed files
with
810 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,6 @@ | ||
.git | ||
.github | ||
.env-sample | ||
.releaserc.json | ||
*test.go | ||
Makefile |
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,17 @@ | ||
# http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_style = space | ||
insert_final_newline = true | ||
max_line_length = 120 | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
max_line_length = 0 | ||
trim_trailing_whitespace = false | ||
|
||
[*.go] | ||
indent_size = 2 |
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,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
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,118 @@ | ||
name: Merge master | ||
|
||
# FIX: remove the following line and uncomment the others to continue | ||
on: {} | ||
# on: | ||
# push: | ||
# branches: | ||
# - master | ||
|
||
|
||
jobs: | ||
prepare: | ||
name: Calculate Version and build number | ||
runs-on: ubuntu-20.04 | ||
|
||
outputs: | ||
build_number: ${{ steps.short_sha.outputs.value }} | ||
new_release: ${{ steps.semantic.outputs.new_release_published }} | ||
release: ${{ steps.semantic.outputs.new_release_version }} | ||
release_notes: ${{ steps.semantic.outputs.new_release_notes }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
token: ${{ secrets.ACCESS_TOKEN }} | ||
|
||
- uses: cycjimmy/semantic-release-action@v2 | ||
id: semantic | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | ||
with: | ||
dry_run: true | ||
|
||
- name: Git Short sha | ||
id: short_sha | ||
run: echo "::set-output name=value::$(git rev-parse --short HEAD)" | ||
|
||
|
||
build: | ||
if: needs.prepare.outputs.new_release == 'true' | ||
|
||
name: Build | ||
runs-on: ubuntu-20.04 | ||
|
||
needs: | ||
- prepare | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.16' | ||
|
||
- name: Cache Go modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.OS }}-build-${{ env.cache-name }}- | ||
${{ runner.OS }}-build- | ||
${{ runner.OS }}- | ||
- name: Build for test | ||
run: make build | ||
|
||
|
||
dev-release: | ||
if: needs.prepare.outputs.new_release == 'true' | ||
|
||
name: Dev Release | ||
runs-on: ubuntu-20.04 | ||
|
||
needs: | ||
- prepare | ||
- build | ||
|
||
steps: | ||
- name: Create Pre Release | ||
uses: actions/create-release@v1 | ||
env: | ||
BUILD: ${{ needs.prepare.outputs.build_number }} | ||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | ||
VERSION: ${{ needs.prepare.outputs.release }} | ||
with: | ||
tag_name: ${{ env.VERSION }}.${{ env.BUILD }} | ||
release_name: ${{ env.VERSION }}.${{ env.BUILD }} | ||
body: ${{ github.event.head_commit.message }} | ||
prerelease: true | ||
|
||
|
||
draft-release: | ||
if: needs.prepare.outputs.new_release == 'true' | ||
|
||
name: Draft Release | ||
runs-on: ubuntu-20.04 | ||
|
||
needs: | ||
- prepare | ||
- build | ||
|
||
steps: | ||
- name: Delete Previous drafts | ||
uses: hugo19941994/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | ||
|
||
- name: Create Draft Release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | ||
with: | ||
tag_name: ${{ needs.prepare.outputs.release }} | ||
release_name: ${{ needs.prepare.outputs.release }} | ||
body: ${{ needs.prepare.outputs.release_notes }} | ||
draft: true |
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,142 @@ | ||
name: Prereleased | ||
|
||
# FIX: remove the following line and uncomment the others to continue | ||
on: {} | ||
# on: | ||
# release: | ||
# types: | ||
# - prereleased | ||
|
||
|
||
env: | ||
COMPONENT: laboratory-controller | ||
COMPONENT_PATH: apps/laboratory-controller | ||
|
||
API_CONTAINER: api_container_image | ||
API_DOCKER_IMAGE_URL: ${{ secrets.PRIVATE_CONTAINER_REGISTRY }}/${{ github.repository_owner }}/laboratory-controller/api | ||
|
||
MANAGER_CONTAINER: manager_container_image | ||
MANAGER_DOCKER_IMAGE_URL: ${{ secrets.PRIVATE_CONTAINER_REGISTRY }}/${{ github.repository_owner }}/laboratory-controller/manager | ||
|
||
|
||
jobs: | ||
cancel_previous: | ||
name: 'Cancel Previous Runs' | ||
runs-on: ubuntu-20.04 | ||
timeout-minutes: 3 | ||
|
||
steps: | ||
- uses: ydataai/[email protected] | ||
with: | ||
ignore_sha: true | ||
access_token: ${{ secrets.ACCESS_TOKEN }} | ||
|
||
|
||
prepare: | ||
name: Prepare | ||
runs-on: ubuntu-20.04 | ||
|
||
needs: | ||
- cancel_previous | ||
|
||
outputs: | ||
version: ${{ steps.version.outputs.value }} | ||
|
||
steps: | ||
- name: Version | ||
id: version | ||
run: echo ::set-output name=value::${GITHUB_REF#refs/*/} | ||
|
||
|
||
build-api: | ||
name: Build API | ||
runs-on: ubuntu-20.04 | ||
|
||
needs: | ||
- prepare | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: docker/login-action@v1 | ||
with: | ||
registry: ${{ secrets.PRIVATE_CONTAINER_REGISTRY }} | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GHCR_TOKEN }} | ||
|
||
- uses: docker/setup-buildx-action@v1 | ||
|
||
- uses: docker/build-push-action@v2 | ||
id: docker_build | ||
with: | ||
file: api.Dockerfile | ||
push: true | ||
tags: ${{ env.API_DOCKER_IMAGE_URL }}:${{ needs.prepare.outputs.version }} | ||
secrets: | | ||
GIT_AUTH_TOKEN=${{ secrets.GHCR_TOKEN }} | ||
build-manager: | ||
name: Build Manager | ||
runs-on: ubuntu-20.04 | ||
|
||
needs: | ||
- prepare | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: docker/login-action@v1 | ||
with: | ||
registry: ${{ secrets.PRIVATE_CONTAINER_REGISTRY }} | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GHCR_TOKEN }} | ||
|
||
- uses: docker/setup-buildx-action@v1 | ||
|
||
- uses: docker/build-push-action@v2 | ||
id: docker_build | ||
with: | ||
file: manager.Dockerfile | ||
push: true | ||
tags: ${{ env.MANAGER_DOCKER_IMAGE_URL }}:${{ needs.prepare.outputs.version }} | ||
secrets: | | ||
GIT_AUTH_TOKEN=${{ secrets.GHCR_TOKEN }} | ||
update-manifests: | ||
name: Update Manifests | ||
runs-on: ubuntu-20.04 | ||
|
||
needs: | ||
- prepare | ||
- build-api | ||
- build-manager | ||
|
||
steps: | ||
- name: Checkout Manifests repo | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: ydataai/manifests | ||
token: ${{ secrets.ACCESS_TOKEN }} | ||
|
||
- uses: imranismail/setup-kustomize@v1 | ||
with: | ||
kustomize-version: "3.8.5" | ||
|
||
- name: Update kustomization image tag | ||
env: | ||
VERSION: ${{ needs.prepare.outputs.version }} | ||
run: | | ||
cd ${COMPONENT_PATH} | ||
kustomize edit set image ${API_CONTAINER}=${API_DOCKER_IMAGE_URL}:${VERSION} | ||
kustomize edit set image ${MANAGER_CONTAINER}=${MANAGER_DOCKER_IMAGE_URL}:${VERSION} | ||
- name: Commit and push image update into manifests repo | ||
env: | ||
VERSION: ${{ needs.prepare.outputs.version }} | ||
run: | | ||
git config user.email "[email protected]" | ||
git config user.name "Azory YData Bot" | ||
git commit -a -m "chore(bump): [CI] [DEV] bump ${COMPONENT} to $VERSION" | ||
git push origin master |
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 @@ | ||
name: Pull request | ||
|
||
# FIX: remove the following line and uncomment the others to continue | ||
on: {} | ||
# on: | ||
# pull_request: | ||
# branches: | ||
# - master | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.16' | ||
|
||
- name: Cache Go modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.OS }}-build-${{ env.cache-name }}- | ||
${{ runner.OS }}-build- | ||
${{ runner.OS }}- | ||
- name: Run vet | ||
run: make vet |
Oops, something went wrong.