forked from flyteorg/flyte
-
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.
Add github_actions boilerplate (#11)
* Add github_actions boilerplate * Fix numbering * Parameterize actions further to support forks * remove dockerhub push
- Loading branch information
Showing
4 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
boilerplate-repo/boilerplate/lyft/github_workflows/Readme.rst
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,20 @@ | ||
Golang Github Actions | ||
~~~~~~~~~~~~~~~~~ | ||
|
||
Provides a two github actions workflows. | ||
|
||
**To Enable:** | ||
|
||
Add ``lyft/github_workflows`` to your ``boilerplate/update.cfg`` file. | ||
|
||
Add a github secret ``flytegithub_repo`` with a the name of your fork (e.g. ``my_company/flytepropeller``). | ||
|
||
The actions will push to 2 repos: | ||
|
||
1. ``docker.pkg.github.com/lyft/<repo>/operator`` | ||
2. ``docker.pkg.github.com/lyft/<repo>/operator-stages`` : this repo is used to cache build stages to speed up iterative builds after. | ||
|
||
There are two workflows that get deployed: | ||
|
||
1. A workflow that runs on Pull Requests to build and push images to github registy tagged with the commit sha. | ||
2. A workflow that runs on master merges that bump the patch version of release tag, builds and pushes images to github registry tagged with the version, commit sha as well as "latest" |
31 changes: 31 additions & 0 deletions
31
boilerplate-repo/boilerplate/lyft/github_workflows/master.yml
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,31 @@ | ||
name: Master | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
with: | ||
fetch-depth: '0' | ||
- name: Bump version and push tag | ||
id: bump-version | ||
uses: anothrNick/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
WITH_V: true | ||
DEFAULT_BUMP: patch | ||
- name: Push Docker Image to Github Registry | ||
uses: whoan/docker-build-with-cache-action@v5 | ||
with: | ||
username: "${{ github.actor }}" | ||
password: "${{ secrets.GITHUB_TOKEN }}" | ||
image_name: ${{ secrets.flytegithub_repo }}/operator | ||
image_tag: latest,${{ github.sha }},${{ steps.bump-version.outputs.tag }} | ||
push_git_tag: true | ||
registry: docker.pkg.github.com | ||
build_extra_args: "--compress=true" |
19 changes: 19 additions & 0 deletions
19
boilerplate-repo/boilerplate/lyft/github_workflows/pull_request.yml
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,19 @@ | ||
name: Pull Request | ||
|
||
on: | ||
pull_request | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Push Docker Image to Github Registry | ||
uses: whoan/docker-build-with-cache-action@v5 | ||
with: | ||
username: "${{ github.actor }}" | ||
password: "${{ secrets.GITHUB_TOKEN }}" | ||
image_name: ${{ secrets.flytegithub_repo }}/operator | ||
image_tag: ${{ github.sha }} | ||
push_git_tag: true | ||
registry: docker.pkg.github.com |
16 changes: 16 additions & 0 deletions
16
boilerplate-repo/boilerplate/lyft/github_workflows/update.sh
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,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
# WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES. | ||
# ONLY EDIT THIS FILE FROM WITHIN THE 'LYFT/BOILERPLATE' REPOSITORY: | ||
# | ||
# TO OPT OUT OF UPDATES, SEE https://github.com/lyft/boilerplate/blob/master/Readme.rst | ||
|
||
set -e | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" | ||
|
||
mkdir -p ${DIR}/../../../.github/workflows | ||
|
||
echo " - generating github action workflows in root directory." | ||
sed -e "s/{{REPOSITORY}}/${REPOSITORY}/g" ${DIR}/master.yml > ${DIR}/../../../.github/workflows/master.yml | ||
sed -e "s/{{REPOSITORY}}/${REPOSITORY}/g" ${DIR}/pull_request.yml > ${DIR}/../../../.github/workflows/pull_request.yml |