-
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.
added version, docker-publish and go-check workflows
- Loading branch information
Showing
8 changed files
with
170 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,57 @@ | ||
name: docker-publish | ||
on: | ||
workflow_call: | ||
inputs: | ||
appName: | ||
required: true | ||
type: string | ||
dockerfilePath: | ||
required: false | ||
default: ./Dockerfile | ||
type: string | ||
dockerRepo: | ||
required: false | ||
default: proxima.one/services | ||
type: string | ||
secrets: | ||
DOCKER_REGISTRY_URL: | ||
required: false | ||
DOCKER_USERNAME: | ||
required: false | ||
DOCKER_PASSWORD: | ||
required: false | ||
PROXIMA_GITHUB_USER: | ||
required: false | ||
PROXIMA_GITHUB_TOKEN: | ||
required: false | ||
|
||
jobs: | ||
version: | ||
uses: proxima-one/github-workflows/.github/workflows/version.yml@master | ||
with: | ||
appName: ${{ inputs.appName }} | ||
dockerRepo: ${{ inputs.dockerRepo }} | ||
secrets: | ||
DOCKER_REGISTRY_URL: ${{ secrets.DOCKER_REGISTRY_URL }} | ||
|
||
publish: | ||
needs: version | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v2 | ||
|
||
- name: "Write .netrc" | ||
run: echo "machine github.com login ${{ secrets.PROXIMA_GITHUB_USER }} password ${{ secrets.PROXIMA_GITHUB_TOKEN }}" > ./.netrc | ||
|
||
- name: "Docker Login" | ||
run: docker login -u="${{ secrets.DOCKER_USERNAME }}" -p="${{ secrets.DOCKER_PASSWORD }}" ${{ secrets.DOCKER_REGISTRY_URL }} | ||
|
||
- name: Build Image | ||
run: | | ||
DOCKER_BUILDKIT=1 docker build . --build-arg BUILD_VERSION=${{ needs.version.outputs.VERSION }} --tag image --file ${{ inputs.dockerfilePath }} --target prod --progress=plain | ||
- name: Push image | ||
run: | | ||
docker tag image ${{ needs.version.outputs.IMAGE_FULL_NAME }} | ||
docker push ${{ needs.version.outputs.IMAGE_FULL_NAME }} |
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: go-check | ||
on: | ||
workflow_call: | ||
secrets: | ||
PROXIMA_GITHUB_TOKEN: | ||
required: true | ||
|
||
jobs: | ||
quick-check: | ||
name: Golang Tests | ||
runs-on: ubuntu-latest | ||
env: | ||
GOPRIVATE: github.com/proxima-one/block-indexer-api/api | ||
PROXIMA_GITHUB_TOKEN: ${{ secrets.PROXIMA_GITHUB_TOKEN }} | ||
defaults: | ||
run: | ||
working-directory: . | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.18 | ||
|
||
- name: Checkout Code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup credentials | ||
run: git config --global url.https://[email protected]/.insteadOf https://github.com/ | ||
|
||
- name: Install dependencies | ||
run: go get ./... | ||
|
||
- name: Unit Tests | ||
run: go test --short ./... |
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,47 @@ | ||
name: read-version | ||
on: | ||
workflow_call: | ||
inputs: | ||
appName: | ||
required: true | ||
type: string | ||
dockerRepo: | ||
required: true | ||
type: string | ||
secrets: | ||
DOCKER_REGISTRY_URL: | ||
required: true | ||
outputs: | ||
version: | ||
description: "Version of image" | ||
value: ${{ jobs.readVersion.outputs.version }} | ||
imageTag: | ||
description: "Image tag of image" | ||
value: ${{ jobs.readVersion.outputs.imageTag }} | ||
imageId: | ||
description: "Id (url without Docker registry) of image" | ||
value: ${{ jobs.readVersion.outputs.imageId }} | ||
|
||
jobs: | ||
readVersion: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.version.outputs.VERSION }} | ||
imageTag: ${{ steps.version.outputs.IMAGE_TAG }} | ||
imageId: ${{ steps.version.outputs.IMAGE_ID }} | ||
steps: | ||
- name: "Read Version" | ||
id: version | ||
run: | | ||
VERSION=$(cat ./VERSION) | ||
IMAGE_TAG=${{ inputs.appName }}-$VERSION-${GITHUB_SHA::7} | ||
IMAGE_ID=/${{ inputs.dockerRepo }}:$IMAGE_TAG | ||
IMAGE_FULL_NAME=${{ secrets.DOCKER_REGISTRY_URL }}$IMAGE_ID | ||
echo VERSION=$VERSION | ||
echo IMAGE_ID=$IMAGE_ID | ||
echo IMAGE_FULL_NAME=$IMAGE_FULL_NAME | ||
echo IMAGE_TAG=$IMAGE_TAG | ||
echo "::set-output name=VERSION::$VERSION" | ||
echo "::set-output name=IMAGE_TAG::$IMAGE_TAG" | ||
echo "::set-output name=IMAGE_FULL_NAME::$IMAGE_FULL_NAME" | ||
echo "::set-output name=IMAGE_ID::$IMAGE_ID" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.