Skip to content

Commit

Permalink
ENG-327: Plural release process (#421)
Browse files Browse the repository at this point in the history
* init elixir changes

Signed-off-by: DavidSpek <[email protected]>

* extend generated release notes

Signed-off-by: DavidSpek <[email protected]>

* have make use git tag

Signed-off-by: DavidSpek <[email protected]>

* init add workflows

Signed-off-by: DavidSpek <[email protected]>

* add push to Plural action

Signed-off-by: DavidSpek <[email protected]>

* test fix removal of VERSION file in config.exs

Signed-off-by: DavidSpek <[email protected]>

* fix git version in docker file

Signed-off-by: DavidSpek <[email protected]>

* fix getting version from git tag for apps

Signed-off-by: DavidSpek <[email protected]>

* cleanup make build command

Signed-off-by: DavidSpek <[email protected]>

* remove unused phoenix code from dockerfile

Signed-off-by: DavidSpek <[email protected]>

* cleanup tools download

Signed-off-by: DavidSpek <[email protected]>

* cleanup old CI action

Signed-off-by: DavidSpek <[email protected]>

* clean up version function

Signed-off-by: DavidSpek <[email protected]>
Co-authored-by: michaeljguarino <[email protected]>
  • Loading branch information
davidspek and michaeljguarino authored Sep 9, 2022
1 parent e7e9d9e commit 343c674
Show file tree
Hide file tree
Showing 17 changed files with 588 additions and 145 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ deps/
charts/
.vscode/
log/
.git/
.gitignore
.dockerignore
Dockerfile*
Expand Down
12 changes: 7 additions & 5 deletions .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ changelog:
exclude:
labels:
- ignore-for-release
authors:
- plural-bot
- renovate
- dependabot
categories:
- title: Breaking Changes ⚠️
labels:
Expand All @@ -17,4 +13,10 @@ changelog:
- enhancement
- title: Bug Fixes 🐛
labels:
- bug-fix
- bug-fix
- title: Dependency Updates
labels:
- dependencies
- title: Other Changes
labels:
- "*"
204 changes: 204 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
name: CD / Plural

on:
push:
tags:
- 'v*.*.*'
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
with:
elixir-version: '1.11.4' # Define the elixir version [required]
otp-version: '23.1.5' # Define the OTP version [required]
- uses: azure/setup-helm@v1
with:
version: latest
- name: install plural cli
run: |
wget -O plural.o 'https://app.plural.sh/artifacts/plural/plural?platform=linux&arch=amd64'
chmod +x ./plural.o
cp ./plural.o /usr/local/bin/plural
- run: make testup
- name: Restore dependencies cache
uses: actions/cache@v2
with:
path: deps
key: ${{ runner.os }}-mix-2-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-2
- name: Restore _build
uses: actions/cache@v2
with:
path: _build
key: ${{ runner.os }}-mix-2-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-2
- run: mix deps.get
- run: mix test
- uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: workflow,job,repo,message,commit,author
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} # required
if: always()
publish:
name: Build and push Plural containers
runs-on: ubuntu-latest
needs: test
strategy:
matrix:
app: [ plural, cron, worker, rtc ]
permissions:
contents: 'read'
id-token: 'write'
packages: 'write'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Docker meta ${{ matrix.app }}
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
dkr.plural.sh/plural/${{ matrix.app }}
gcr.io/pluralsh/${{ matrix.app }}
ghcr.io/pluralsh/${{ matrix.app }}
# generate Docker tags based on the following events/attributes
tags: |
type=semver,pattern={{version}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- uses: google-github-actions/auth@v0
with:
workload_identity_provider: 'projects/${{ secrets.GOOGLE_PROJECT_ID }}/locations/global/workloadIdentityPools/github/providers/github'
service_account: '[email protected]'
token_format: 'access_token'
create_credentials_file: true
- uses: google-github-actions/[email protected]
- name: Login to gcr
run: gcloud auth configure-docker -q
- name: Login to plural registry
uses: docker/login-action@v2
with:
registry: dkr.plural.sh
username: [email protected]
password: ${{ secrets.PLURAL_ACCESS_TOKEN }}
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push ${{ matrix.app }}
uses: docker/build-push-action@v3
with:
context: "."
file: "./Dockerfile"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
APP_NAME=${{ matrix.app }}
GIT_COMMIT=$GITHUB_SHA
- name: slack webhook
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: workflow,job,repo,message,commit,author
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} # required
if: always()
publish-frontend:
name: Build and push Plural frontend container
runs-on: ubuntu-latest
needs: test
permissions:
contents: 'read'
id-token: 'write'
packages: 'write'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
dkr.plural.sh/plural/plural-www
gcr.io/pluralsh/plural-www
ghcr.io/pluralsh/plural-www
# generate Docker tags based on the following events/attributes
tags: |
type=semver,pattern={{version}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- uses: google-github-actions/auth@v0
with:
workload_identity_provider: 'projects/${{ secrets.GOOGLE_PROJECT_ID }}/locations/global/workloadIdentityPools/github/providers/github'
service_account: '[email protected]'
token_format: 'access_token'
create_credentials_file: true
- uses: google-github-actions/[email protected]
- name: Login to gcr
run: gcloud auth configure-docker -q
- name: Login to plural registry
uses: docker/login-action@v2
with:
registry: dkr.plural.sh
username: [email protected]
password: ${{ secrets.PLURAL_ACCESS_TOKEN }}
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push ${{ matrix.app }}
uses: docker/build-push-action@v3
with:
context: "./www"
file: "./www/Dockerfile"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
- name: slack webhook
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: workflow,job,repo,message,commit,author
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} # required
if: always()
release:
name: Create GitHub release
runs-on: ubuntu-latest
needs: publish
permissions:
contents: write
discussions: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
30 changes: 30 additions & 0 deletions .github/workflows/push-to-plural.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CD / Plural

on:
push:
branches:
- "master"
paths:
- "plural/**"
jobs:
deploy:
name: Push Plural artifact to Plural
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
- uses: azure/setup-helm@v2
with:
version: latest
- name: installing plural
uses: pluralsh/[email protected]
with:
config: ${{ secrets.PLURAL_CONF }}
- run: make deploy
- uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: workflow,job,repo,message,commit,author
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} # required
if: always()
100 changes: 28 additions & 72 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,39 @@ jobs:
matrix:
app: [ plural, cron, worker, rtc ]
steps:
- uses: actions/checkout@v3
- id: version
uses: juliangruber/read-file-action@v1
- name: Checkout
uses: actions/checkout@v3
with:
path: ./VERSION
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Build ${{ matrix.app }} image
uses: docker/build-push-action@v2
fetch-depth: 0
- name: Docker meta ${{ matrix.app }}
id: meta
uses: docker/metadata-action@v4
with:
context: .
file: ./Dockerfile
# list of Docker images to use as base name for tags
images: |
dkr.plural.sh/plural/${{ matrix.app }}
gcr.io/pluralsh/${{ matrix.app }}
ghcr.io/pluralsh/${{ matrix.app }}
# generate Docker tags based on the following events/attributes
tags: |
type=semver,pattern={{version}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Test Build ${{ matrix.app }} image
uses: docker/build-push-action@v3
with:
context: "."
file: "./Dockerfile"
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
APP_NAME=${{ matrix.app }}
APP_VSN=${{ steps.version.outputs.content }}
GIT_COMMIT=$GITHUB_SHA
test:
name: Test
Expand Down Expand Up @@ -69,64 +86,3 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} # required
if: always()
publish:
name: Publish
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/master'
strategy:
matrix:
app: [plural, cron, worker, rtc, www]
permissions:
contents: 'read'
id-token: 'write'
steps:
- uses: actions/checkout@v2
- uses: google-github-actions/auth@v0
with:
workload_identity_provider: 'projects/${{ secrets.GOOGLE_PROJECT_ID }}/locations/global/workloadIdentityPools/github/providers/github'
service_account: '[email protected]'
token_format: 'access_token'
create_credentials_file: true
- uses: google-github-actions/[email protected]
- name: Login to gcr
run: gcloud auth configure-docker -q
- name: Login to plural registry
uses: docker/login-action@v1
with:
registry: dkr.plural.sh
username: [email protected]
password: ${{ secrets.PLURAL_ACCESS_TOKEN }}
- name: publish ${{ matrix.app }}
run: |
make build APP_NAME=${{ matrix.app }} GIT_COMMIT=$GITHUB_SHA
make push APP_NAME=${{ matrix.app }}
- uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: workflow,job,repo,message,commit,author
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} # required
if: always()
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: publish
steps:
- uses: actions/checkout@v2
- uses: hashicorp/setup-terraform@v1
- uses: azure/setup-helm@v1
with:
version: latest
- name: installing plural
uses: pluralsh/[email protected]
with:
config: ${{ secrets.PLURAL_CONF }}
- run: make deploy
- uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: workflow,job,repo,message,commit,author
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} # required
if: always()
Loading

0 comments on commit 343c674

Please sign in to comment.