From 13d2c98fbe5d5260502f96555a0e14bf93c002a0 Mon Sep 17 00:00:00 2001 From: Michel Wilhelm Date: Tue, 30 Aug 2022 18:51:57 -0300 Subject: [PATCH] chore: moving to github actions --- .circleci/config.yml | 21 -------- .github/release-drafter.yml | 40 ++++++++++++++ .github/workflows/main.yml | 34 ------------ .github/workflows/on_release.yml | 53 +++++++++++++++++++ .../workflows/release-drafter-releaser.yml | 16 ++++++ .github/workflows/stage.yml | 26 --------- 6 files changed, 109 insertions(+), 81 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/release-drafter.yml delete mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/on_release.yml create mode 100644 .github/workflows/release-drafter-releaser.yml delete mode 100644 .github/workflows/stage.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 12a4918..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,21 +0,0 @@ -version: 2.1 - -orbs: - python: circleci/python@0.2.1 - -jobs: - build-and-test: - executor: python/default - steps: - - checkout - - python/load-cache - - python/install-deps - - python/save-cache - - run: - command: ./manage.py test - name: Test - -workflows: - main: - jobs: - - build-and-test diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..2e17c87 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,40 @@ +name-template: 'v$RESOLVED_VERSION' +tag-template: 'v$RESOLVED_VERSION' +categories: + - title: 'πŸš€ Features' + label: 'feature' + - title: 'πŸ›  Maintenance' + label: 'maintenance' + - title: 'πŸ› Bug Fixes' + label: 'bug' +version-resolver: + major: + labels: + - 'major' + minor: + labels: + - 'feature' + patch: + labels: + - 'maintenance' + - 'bug' + default: patch +replacers: + - search: '/([A-Z]{2,5}-\d{1,6})/g' + replace: '[$1](https://imakecodes.atlassian.net/browse/$1)' +autolabeler: + - label: 'maintenance' + title: + - '/^chore.+/i' + - label: 'bug' + title: + - '/^fix.+/i' + - label: 'feature' + title: + - '/^feat.+/i' + - label: 'major' + title: + - '/^[a-zA-Z]+(\(.*?\))?!:.+/i' +template: | + ## What’s Changed + $CHANGES diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 5696c23..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Creates a docker image for production - -on: - push: - branches: [main] - -jobs: - docker: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v1 - with: - fetch-depth: 1 - # - name: Docker Build & Push to GitHub Package - # uses: opspresso/action-docker@master - # with: - # args: --docker - # env: - # USERNAME: ${{ secrets.NEXUS_USERNAME }} - # PASSWORD: ${{ secrets.NEXUS_PASSWORD }} - # REGISTRY: "docker.nexus.makecodes.dev" - # DOCKERFILE: "Dockerfile" - # IMAGE_NAME: "mines-backend" - # TAG_NAME: "main" - # LATEST: "true" - - name: "Build:dockerimage" - uses: docker/build-push-action@v1 - with: - registry: ghcr.io - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - repository: imakecodes/mines-backend - tags: latest diff --git a/.github/workflows/on_release.yml b/.github/workflows/on_release.yml new file mode 100644 index 0000000..f8c7a4c --- /dev/null +++ b/.github/workflows/on_release.yml @@ -0,0 +1,53 @@ +name: Creates a docker image for production + +on: + push: + tags: + - 'v*' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Build started + uses: voxmedia/github-action-slack-notify-build@v1 + if: success() + with: + channel: ci-notifications + status: STARTED + color: good + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 1 + - name: Log in to Docker Hub + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: redbeard/minies-backend + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + env: + NEXT_PUBLIC_VERSION: ${github.ref_name} + NEXT_PUBLIC_SCOPE: ${{ secrets.NEXT_PUBLIC_SCOPE }} + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + - name: Build finished + if: success() + uses: voxmedia/github-action-slack-notify-build@v1 + with: + channel: ci-notifications + status: SUCCESS + color: good + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} diff --git a/.github/workflows/release-drafter-releaser.yml b/.github/workflows/release-drafter-releaser.yml new file mode 100644 index 0000000..f3a2f77 --- /dev/null +++ b/.github/workflows/release-drafter-releaser.yml @@ -0,0 +1,16 @@ +name: Release Drafter +on: + push: + # branches to consider in the event; optional, defaults to all + branches: + - main +jobs: + update_release_draft: + runs-on: ubuntu-latest + steps: + # Drafts your next Release notes as Pull Requests are merged into "master" + - uses: release-drafter/release-drafter@v5 + # with: + # disable-autolabeler: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/stage.yml b/.github/workflows/stage.yml deleted file mode 100644 index 2bc0b0d..0000000 --- a/.github/workflows/stage.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Deploy to stage - -on: - push: - branches: [feature/*, hotfix/*] - -jobs: - docker: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v1 - with: - fetch-depth: 1 - - name: Docker Build & Push to GitHub Package - uses: opspresso/action-docker@master - with: - args: --docker - env: - USERNAME: "imakecodes" - PASSWORD: ${{ secrets.GH_TOKEN }} - REGISTRY: "docker.pkg.github.com" - DOCKERFILE: "Dockerfile" - IMAGE_NAME: "minesweeper-backend" - TAG_NAME: "stage" - LATEST: "true"