diff --git a/.github/workflows/create-release.yaml b/.github/workflows/create-release.yaml deleted file mode 100644 index a97324ffd9..0000000000 --- a/.github/workflows/create-release.yaml +++ /dev/null @@ -1,40 +0,0 @@ -name: create-release - -on: - workflow_dispatch: - inputs: - pre_release: - description: "Should this be a pre-release for staging?" - required: true - type: boolean - default: true - pre_release_branch: - description: "Branch to use for pre-release" - required: false - type: string - default: "main" - -jobs: - create-release: - runs-on: ubuntu-latest - steps: - - name: checkout-repo - uses: actions/checkout@v4 - with: - fetch-depth: 0 - fetch-tags: true - token: ${{ secrets.KIVA_ROBOT_GITHUB_PAT }} - - name: checkout-actions - uses: actions/checkout@v4 - with: - repository: kiva/github-actions - token: ${{ secrets.KIVA_ROBOT_GITHUB_PAT }} - path: .github/ - - name: create-release - id: release - uses: ./.github/actions/start-semantic-release - env: - GITHUB_PAT: ${{ secrets.KIVA_ROBOT_GITHUB_PAT }} - with: - pre_release: "${{ github.event.inputs.pre_release }}" - pre_release_branch: ${{ github.event.inputs.pre_release_branch }} diff --git a/.github/workflows/release-build.yaml b/.github/workflows/release-build.yaml index 43ed3d3e96..2fbc713e50 100644 --- a/.github/workflows/release-build.yaml +++ b/.github/workflows/release-build.yaml @@ -5,9 +5,6 @@ on: push: branches: - main - tags: - - 'v[0-9]+.[0-9]+.[0-9]+' - - 'v[0-9]+.[0-9]+.[0-9]+-rc*' env: GITHUB_PAT: "${{ secrets.KIVA_ROBOT_GITHUB_PAT }}" @@ -55,8 +52,8 @@ jobs: # Build and push the image to ECR build: runs-on: ubuntu-latest - # Run on merges to development or tag pushes (done by create-release workflow) - if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags') + # Run on merges to development (main) + if: github.ref == 'refs/heads/main' steps: - name: Checkout uses: actions/checkout@v3 diff --git a/.github/workflows/semantic-release.yaml b/.github/workflows/semantic-release.yaml index 2dff706ccf..9983a5376f 100644 --- a/.github/workflows/semantic-release.yaml +++ b/.github/workflows/semantic-release.yaml @@ -1,32 +1,81 @@ name: Semantic Release on: - push: - branches: - - staging - - production + workflow_dispatch: + inputs: + environment: + type: choice + description: 'Environment to release to. Select "staging" for a pre-release or "production" for a full release.' + options: + - staging + - production + required: true jobs: + # Create a release create-release: runs-on: ubuntu-latest + outputs: + published: ${{ steps.release.outputs.published }} + tag: ${{ steps.release.outputs.tag }} steps: - - name: checkout-repo + - name: Checkout repo uses: actions/checkout@v4 with: fetch-depth: 0 fetch-tags: true persist-credentials: false token: ${{ secrets.KIVA_ROBOT_GITHUB_PAT }} - - name: checkout-actions + - name: Checkout actions uses: actions/checkout@v4 with: repository: kiva/github-actions token: ${{ secrets.KIVA_ROBOT_GITHUB_PAT }} persist-credentials: false path: .github/ - - name: semantic-release + - name: Run semantic-release + id: release uses: ./.github/actions/semantic-release env: GITHUB_PAT: ${{ secrets.KIVA_ROBOT_GITHUB_PAT }} with: config: "node" + + # Build and push the image to ECR if the release was published + build-image: + runs-on: ubuntu-latest + needs: create-release + if: needs.create-release.outputs.published == 'true' + env: + GITHUB_PAT: "${{ secrets.KIVA_ROBOT_GITHUB_PAT }}" + AWS_REGION: "us-west-2" + AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}" + AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}" + SLACK_BOT_TOKEN: "${{ secrets.SLACK_TOKEN }}" + SLACK_CHANNEL: "eng-build-failures" + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ needs.create-release.outputs.tag }} + - uses: actions/checkout@v4 + with: + repository: kiva/github-actions + token: ${{ env.GITHUB_PAT }} + path: .github/ + - uses: snow-actions/sparse-checkout@v1.2.0 + with: + repository: kiva/marketplace-web-ui-ci + token: ${{ env.GITHUB_PAT }} + path: .docker + ref: main + patterns: | + resources/org/kiva/marketplaceWebUiCi/ui + - name: move files + run: | + mv .docker/resources/org/kiva/marketplaceWebUiCi/ui/Dockerfile . + - name: docker-build + uses: ./.github/actions/docker-build-push + with: + dockerfile_target: "release" + push: true