Skip to content

Commit

Permalink
chore(pipelines): change actions to promote versions (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
renatoaguimaraes authored Oct 26, 2021
1 parent 2566900 commit 42e60e4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 97 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/merge_master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: master

on:
push:
branches: [ master ]
branches:
- master

jobs:
prepare:
Expand Down Expand Up @@ -76,7 +77,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
VERSION: ${{ needs.prepare.outputs.release }}
with:
tag_name: build/${{ env.VERSION }}/${{ env.BUILD }}
tag_name: ${{ env.VERSION }}.${{ env.BUILD }}
release_name: ${{ env.VERSION }}.${{ env.BUILD }}
body: ${{ github.event.head_commit.message }}
prerelease: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prereleased.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
steps:
- name: Version
id: version
run: echo ::set-output name=value::`echo ${{ github.ref }} | sed -n -E 's/refs\/tags\/build\/([0-9]+.[0-9]+.[0-9]+)\/([[:alnum:]])/\1.\2/p'`
run: echo ::set-output name=value::${GITHUB_REF#refs/*/}
94 changes: 0 additions & 94 deletions .github/workflows/released.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@ on:
release:
types: [ released ]

env:
COMPONENT: laboratory-controller

API_CONTAINER: api_container_image
MANAGER_CONTAINER: manager_container_image

DOCKER_CONTAINER_REGISTRY: ${{ secrets.PRIVATE_CONTAINER_REGISTRY }}
API_DOCKER_IMAGE_URL: ${{ secrets.PRIVATE_CONTAINER_REGISTRY }}/${{ github.repository_owner }}/laboratory-controller/api
MANAGER_DOCKER_IMAGE_URL: ${{ secrets.PRIVATE_CONTAINER_REGISTRY }}/${{ github.repository_owner }}/laboratory-controller/manager

jobs:
prepare:
name: Extract Version and Build number
Expand All @@ -33,87 +23,3 @@ jobs:
- name: Git Short sha
id: short_sha
run: echo "::set-output name=value::$(git rev-parse --short HEAD)"


docker-tag-api:
name: Docker Tag and Push API
runs-on: ubuntu-20.04

needs: prepare

steps:
- uses: docker/login-action@v1
with:
registry: ${{ env.DOCKER_CONTAINER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}

- name: Docker tag and push
env:
SOURCE: ${API_DOCKER_IMAGE_URL}:${{ needs.prepare.outputs.version }}.${{ needs.prepare.outputs.build_number }}
DESTINATION: ${API_DOCKER_IMAGE_URL}:${{ needs.prepare.outputs.version }}
run: |
docker pull $SOURCE
docker tag $SOURCE $DESTINATION
docker push $DESTINATION
docker-tag-manager:
name: Docker Tag and Push Manager
runs-on: ubuntu-20.04

needs: prepare

steps:
- uses: docker/login-action@v1
with:
registry: ${{ env.DOCKER_CONTAINER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}

- name: Docker tag and push
env:
SOURCE: ${MANAGER_DOCKER_IMAGE_URL}:${{ needs.prepare.outputs.version }}.${{ needs.prepare.outputs.build_number }}
DESTINATION: ${MANAGER_DOCKER_IMAGE_URL}:${{ needs.prepare.outputs.version }}
run: |
docker pull $SOURCE
docker tag $SOURCE $DESTINATION
docker push $DESTINATION
update-manifests:
name: Update Manifests
runs-on: ubuntu-20.04

needs:
- prepare
- docker-tag-api
- docker-tag-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 ydata/${COMPONENT}
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] [PROD] bump ${{ env.COMPONENT }} to $VERSION"
git push origin master
8 changes: 8 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"tagFormat": "${version}",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github"
]
}

0 comments on commit 42e60e4

Please sign in to comment.