From a66f1bd4c3b02a9bba90546d9459899d70bbc6be Mon Sep 17 00:00:00 2001 From: Victoria Trush Date: Fri, 21 Apr 2023 21:35:45 +0300 Subject: [PATCH 1/2] chore: add github releases flow --- .github/workflows/ci-prod.yml | 30 ++---------- .../create-tag-and-trigger-deploy.yml | 46 ------------------- .github/workflows/prepare-release-draft.yml | 14 ++++++ .github/workflows/prepare-release.yml | 46 ------------------- CHANGELOG.md | 4 ++ README.md | 16 +++---- 6 files changed, 29 insertions(+), 127 deletions(-) delete mode 100644 .github/workflows/create-tag-and-trigger-deploy.yml create mode 100644 .github/workflows/prepare-release-draft.yml delete mode 100644 .github/workflows/prepare-release.yml diff --git a/.github/workflows/ci-prod.yml b/.github/workflows/ci-prod.yml index 6bde5396..8494c897 100644 --- a/.github/workflows/ci-prod.yml +++ b/.github/workflows/ci-prod.yml @@ -1,16 +1,10 @@ name: CI Build prod image on: - workflow_call: - inputs: - tag: - description: "tag to deploy from" - default: "" - required: false - type: string + release: + types: [released] -permissions: - contents: read +permissions: {} jobs: # test: @@ -21,27 +15,11 @@ jobs: # needs: test name: Build and deploy steps: - - name: Checkout - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Tag name - id: tag_name - run: | - if [ '${{ inputs.tag }}' = '' ]; then - echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT - else - echo "TAG=$TAG" >> $GITHUB_OUTPUT - fi - env: - TAG: ${{ inputs.tag }} - - name: Build prod image uses: lidofinance/dispatch-workflow@v1 env: APP_ID: ${{ secrets.APP_ID }} APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} TARGET_REPO: "lidofinance/infra-mainnet" - TAG: "${{ steps.tag_name.outputs.TAG }}" + TAG: "${{ github.event.release.tag_name }}" TARGET_WORKFLOW: "build_mainnet_dao_voting_ui.yaml" diff --git a/.github/workflows/create-tag-and-trigger-deploy.yml b/.github/workflows/create-tag-and-trigger-deploy.yml deleted file mode 100644 index eac3077e..00000000 --- a/.github/workflows/create-tag-and-trigger-deploy.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Create tag and trigger deploy -on: - push: - branches: - - main - -permissions: - contents: write - -jobs: - bump: - name: Create tag and release - runs-on: ubuntu-latest - if: "contains(github.event.head_commit.message, 'chore(release)')" - outputs: - tag: ${{ steps.tag.outputs.tag }} - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - persist-credentials: false - - name: Get tag value - id: tag - run: | - TAG="$(grep -oP '^chore\(release\).*\K(\d+\.\d+\.\d+)' <<< "$MESSAGE")" - echo "$TAG" - echo "tag=$TAG" >> $GITHUB_OUTPUT - env: - MESSAGE: ${{ github.event.head_commit.message }} - - name: Create and push tag - run: | - git tag ${{ steps.tag.outputs.tag }} - git push https://x-access-token:${{ github.token }}@github.com/$GITHUB_REPOSITORY --tags - - name: Create release - uses: lidofinance/action-gh-release@v1 - with: - tag_name: ${{ steps.tag.outputs.tag }} - - deploy-trigger: - needs: bump - name: Trigger build and PR creation in the infra-mainnet - if: "contains(github.event.head_commit.message, 'chore(release)')" - uses: ./.github/workflows/ci-prod.yml - secrets: inherit - with: - tag: ${{ needs.bump.outputs.tag }} diff --git a/.github/workflows/prepare-release-draft.yml b/.github/workflows/prepare-release-draft.yml new file mode 100644 index 00000000..4de99e1a --- /dev/null +++ b/.github/workflows/prepare-release-draft.yml @@ -0,0 +1,14 @@ +name: Prepare release draft +on: + push: + branches: + - main + +permissions: + contents: write + +jobs: + prepare-release-draft: + uses: lidofinance/actions/.github/workflows/prepare-release-draft.yml@main + with: + target: main \ No newline at end of file diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml deleted file mode 100644 index 8a474ba4..00000000 --- a/.github/workflows/prepare-release.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Prepare release - -on: - workflow_dispatch: - -permissions: - contents: write - pull-requests: write - -jobs: - prepare-release: - name: Prepare release and create pre-release PR - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: Bump version and update CHANGELOG.MD - id: changelog - uses: lidofinance/conventional-changelog-action@v3 - with: - git-message: "chore(release): {version}" - tag-prefix: "" - output-file: "CHANGELOG.md" - version-file: package.json - version-path: version - release-count: 10 # save all releases in the CHANGELOG.md - git-push: false - skip-on-empty: false - skip-ci: false - create-summary: true - - - name: Fail on missing args - if: ${{ !steps.changelog.outputs.version }} - run: > - echo "::error::No version output found for the prev step! Try restarting action" && exit 1 - - - name: Create Pull Request - uses: lidofinance/create-pull-request@v4 - if: ${{ steps.changelog.outputs.version }} - with: - branch: pre-release-${{ steps.changelog.outputs.version }} - title: "chore(release): ${{ steps.changelog.outputs.version }}" - body: "This PR is generated automatically.\nMerge it for the automatic tag creation.\nIf you don't need this PR than close it and **delete source branch**! " diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f69ff2b..975a9142 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# This file is no longer used by semantic-release +For the latest release notes, please see the [GitHub releases page](https://github.com/lidofinance/dao-voting-ui/releases). + + # [0.3.0](https://github.com/lidofinance/dao-voting-ui/compare/0.2.0...0.3.0) (2022-06-21) diff --git a/README.md b/README.md index ecdde97a..b89436b0 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ https://www.notion.so/Custom-voting-UI-feature-description-bde7fde42d3749a3afcba - Node.js v12+ - Yarn package manager -This project requires an .env file which is distributed via private communication channels. A sample can be found in .env.sample +This project requires an .env file which is distributed via private communication channels. A sample can be found in .env.sample. ## Development @@ -81,12 +81,10 @@ yarn build && yarn start ## Release flow -To create new release: +To create a new release: -1. Merge all changes to the `main` branch -1. Navigate to Repo => Actions -1. Run action "Prepare release" action against `main` branch -1. When action execution is finished, navigate to Repo => Pull requests -1. Find pull request named "chore(release): X.X.X" review and merge it with "Rebase and merge" (or "Squash and merge") -1. After merge release action will be triggered automatically -1. Navigate to Repo => Actions and see last actions logs for further details \ No newline at end of file +1. Merge all changes to the `main` branch. +1. After the merge, the `Prepare release draft` action will run automatically. When the action is complete, a release draft is created. +1. When you need to release, go to Repo → Releases. +1. Publish the desired release draft manually by clicking the edit button - this release is now the `Latest Published`. +1. After publication, the action to create a release bump will be triggered automatically. \ No newline at end of file From 3c24fe92a37096bf5a65f5328355596157b8a85b Mon Sep 17 00:00:00 2001 From: Victoria Trush Date: Mon, 24 Apr 2023 14:01:40 +0300 Subject: [PATCH 2/2] chore: update curl version --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b61bef1d..1ca12098 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ ENV BASE_PATH=$BASE_PATH ENV NEXT_TELEMETRY_DISABLED=1 WORKDIR /app -RUN apk add --no-cache curl=~7 +RUN apk add --no-cache curl=~8 COPY --from=build /app /app RUN mkdir -p /app/.next/cache/images && chown -R node:node /app/.next/cache/images