Add GHA workflow for pushing releases to Quay

This commit is contained in:
Shane McDonald
2021-04-08 07:10:44 -04:00
parent d8b7ed81b5
commit 295ed47c43
3 changed files with 60 additions and 21 deletions

34
.github/workflows/devel.yaml vendored Normal file
View File

@@ -0,0 +1,34 @@
---
name: Devel
on:
push:
branches: [devel]
jobs:
release:
runs-on: ubuntu-18.04
name: Push devel image
steps:
- uses: actions/checkout@v2
- name: Install Operator-SDK
run: |
mkdir -p $GITHUB_WORKSPACE/bin
wget -O $GITHUB_WORKSPACE/bin/operator-sdk https://github.com/operator-framework/operator-sdk/releases/download/v0.19.4/operator-sdk-v0.19.4-x86_64-linux-gnu
chmod +x $GITHUB_WORKSPACE/bin/operator-sdk
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
- name: Build Image
run: |
operator-sdk build awx-operator:devel
- name: Push To Quay
uses: redhat-actions/push-to-registry@v2.1.1
with:
image: awx-operator
tags: devel
registry: quay.io/ansible/
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}

View File

@@ -3,13 +3,14 @@
name: Release
on:
push:
branches: [devel]
release:
types:
- created
jobs:
release:
runs-on: ubuntu-18.04
name: release
name: Push tagged image to Quay
steps:
- uses: actions/checkout@v2
@@ -22,13 +23,13 @@ jobs:
- name: Build Image
run: |
operator-sdk build awx-operator:devel
operator-sdk build awx-operator:${{ github.event.release.tag_name }}
- name: Push To Quay
uses: redhat-actions/push-to-registry@v2.1.1
with:
image: awx-operator
tags: devel
tags: ${{ github.event.release.tag_name }}
registry: quay.io/ansible/
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}

View File

@@ -502,21 +502,34 @@ There are a few moving parts to this project:
Each of these must be appropriately built in preparation for a new tag:
### Build a new release
### Verify Functionality
Run the following command inside this directory:
```sh
#> operator-sdk build quay.io/ansible/awx-operator:$VERSION
#> operator-sdk build quay.io/<user>/awx-operator:test
```
Then push the generated image to Docker Hub:
```sh
#> docker push quay.io/ansible/awx-operator:$VERSION
#> docker push quay.io/<user>/awx-operator:test
```
### Build a new version of the operator yaml file
After it is built, test it on a local cluster:
```sh
#> minikube start --memory 6g --cpus 4
#> minikube addons enable ingress
#> ansible-playbook ansible/deploy-operator.yml -e operator_image=quay.io/<user>/awx-operator -e operator_version=test
#> kubectl create namespace example-awx
#> ansible-playbook ansible/instantiate-awx-deployment.yml -e tower_namespace=example-awx
#> <test everything>
#> minikube delete
```
### Update version
Update the awx-operator version:
@@ -528,20 +541,11 @@ Once the version has been updated, run from the root of the repo:
#> ansible-playbook ansible/chain-operator-files.yml
```
After it is built, test it on a local cluster:
### Commit / Create Release
If everything works, commit the updated version, then [publish a new release](https://github.com/ansible/awx-operator/releases/new) using the same version you used in `ansible/group_vars/all`.
```sh
#> minikube start --memory 6g --cpus 4
#> minikube addons enable ingress
#> ansible-playbook ansible/deploy-operator.yml
#> kubectl create namespace example-awx
#> ansible-playbook ansible/instantiate-awx-deployment.yml -e tower_namespace=example-awx
#> <test everything>
#> minikube delete
```
If everything works, commit the updated version, then tag a new repository release with the same tag as the Docker image pushed earlier.
After creating the release, [this GitHub Workflow](https://github.com/ansible/awx-operator/blob/devel/.github/workflows/release.yaml) will run and publish the new image to quay.io.
## Author