From 0cc10ab71305e679b2fdc9d23366881d77fc08ec Mon Sep 17 00:00:00 2001 From: Nikita Melnikov Date: Tue, 5 Apr 2022 14:03:13 +0400 Subject: [PATCH] Update workflow: push tagged docker builds (#161) * test new build workflow * fix build workflow * update docs --- .github/workflows/build-and-push.yml | 23 --------------- .github/workflows/build.yml | 42 ++++++++++++++++++++++++++++ README.md | 8 ++++++ 3 files changed, 50 insertions(+), 23 deletions(-) delete mode 100644 .github/workflows/build-and-push.yml create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml deleted file mode 100644 index eb496c5c..00000000 --- a/.github/workflows/build-and-push.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Build and deploy - -on: [push] - -env: - DOCKER_REPO: ${{ secrets.DOCKER_USERNAME }}/codex-docs - -jobs: - build_and_deploy: - runs-on: ubuntu-20.04 - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Build and push docker image - uses: docker/build-push-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - repository: ${{ env.DOCKER_REPO }} - tag_with_ref: true - dockerfile: docker/Dockerfile.prod - push: ${{ endsWith(github.ref, '/stage') || endsWith(github.ref, '/prod') }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..2d45d6cf --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,42 @@ +name: Build and push Docker image + +on: + push: + branches: + - '*' + tags: + - 'v*' + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + runs-on: ubuntu-20.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v3 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push image + uses: docker/build-push-action@v2 + with: + context: . + file: docker/Dockerfile.prod + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + push: ${{ startsWith(github.ref, 'refs/tags/v') || endsWith(github.ref, '/stage') }} diff --git a/README.md b/README.md index 96164d51..79bbfcc8 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,14 @@ To manage pages you need to authorize (available on `/auth`). To generate password use `yarn generatePassword [password]` command. +## Release process + +We use [release-drafter](https://github.com/release-drafter/release-drafter) to generate release notes and GitHub release. +It will automatically generate draft release based pull requests data between current version and previous version. +To make new release you need go to [releases](https://github.com/codex-team/codex.docs/releases) page find the latest draft release and mark it as ready. +After creating new release, new git tag will be created and new version will be published. + + # About CodeX