diff --git a/.github/workflows/release-tag-push.yaml b/.github/workflows/release-tag-push.yaml new file mode 100644 index 0000000..ef9b697 --- /dev/null +++ b/.github/workflows/release-tag-push.yaml @@ -0,0 +1,31 @@ +name: Mark Release Image for Environment Deployment +on: + workflow_dispatch: + inputs: + environment: + description: 'Environment' + required: true + default: 'staging' + # work around until release tags are available https://github.community/t/select-tag-release-when-running-workflow-dispatch/132970 + version: + description: 'Existing Release Tag' + required: true + default: 'vMajor.Minor.Bugfix' +jobs: + build: + name: Tag + runs-on: ubuntu-20.04 + steps: + - name: Checkout Repo + uses: actions/checkout@v2 + - name: Login to GitHub Package Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Add environment tag to release and push + env: + VERSION: ${{ steps.extract_tag.outputs.tag }} + run: | + make deploy version=${{ github.event.inputs.version }} environment=${{ github.event.inputs.environment }} \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 6c45fad..d82d090 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,11 +1,11 @@ name: Release on: release: - types: [prereleased] + types: [prereleased, published] jobs: build: - name: Staging Release + name: Release runs-on: ubuntu-20.04 steps: - name: Checkout Repo @@ -31,11 +31,6 @@ jobs: VERSION: ${{ steps.extract_tag.outputs.tag }} run: | make release version=$VERSION - - name: Publish staging tag to GitHub Package Registry - env: - VERSION: ${{ steps.extract_tag.outputs.tag }} - run: | - make deploy version=$VERSION environment=staging - name: Prune dangling images run: docker image prune -f - name: Upload Release Assets diff --git a/Makefile b/Makefile index 95c5dcd..a62e51a 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,7 @@ release: docker push ${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}:${version} deploy: + docker pull ${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}:${version} docker tag ${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}:${version} ${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}:${environment} docker push ${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}:${environment} diff --git a/deploy/platform/educates/workshop-deploy.yaml b/deploy/platform/educates/workshop-deploy.yaml index 42dbf74..975e4ff 100644 --- a/deploy/platform/educates/workshop-deploy.yaml +++ b/deploy/platform/educates/workshop-deploy.yaml @@ -65,8 +65,8 @@ spec: spec: containers: - name: nginx - image: ghcr.io/platform-acceleration-lab/cnd-deploy-practices:staging - imagePullPolicy: Always + image: cnd-deploy-practices + imagePullPolicy: IfNotPresent - apiVersion: v1 kind: Service metadata: