-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CI GitHub Actions for United Storage #18
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
on: | ||
workflow_dispatch: | ||
release: | ||
types: [published] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }} | ||
cancel-in-progress: false | ||
|
||
name: Build Application Docker | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build: | ||
name: datalens-us | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: docker/setup-buildx-action@v3 | ||
- name: 'Get release build version' | ||
run: | | ||
BUILD_VERSION=$(jq -r '.version' package.json) | ||
COMMIT_NAME=$(git log -n 1 --pretty=format:%s) | ||
echo "Release build version: ${BUILD_VERSION}" | ||
echo "BUILD_VERSION=$BUILD_VERSION" >> "$GITHUB_ENV" | ||
echo "COMMIT_NAME=$COMMIT_NAME" >> "$GITHUB_ENV" | ||
- name: Log in to the Container registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract tags for Docker | ||
id: meta | ||
uses: docker/[email protected] | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=raw,value=${{ env.BUILD_VERSION }} | ||
${{ contains(env.COMMIT_NAME, '[release]') && 'type=raw,value=latest' || '' }} | ||
- name: Build and push Docker image | ||
uses: docker/[email protected] | ||
with: | ||
build-args: | | ||
app_version=${{ env.BUILD_VERSION }} | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
on: | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
name: Lint, Typecheck, Unit tests | ||
|
||
jobs: | ||
build: | ||
name: datalens-us | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: 'npm' | ||
- run: npm ci | ||
- run: npm run lint | ||
- run: npm run typecheck | ||
- run: npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
name: Publish Platform | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
name: datalens-us | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: . | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: 'npm' | ||
- name: 'Get last release' | ||
run: | | ||
COMMIT_NAME=$(git log -n 1 --pretty=format:%s) | ||
|
||
LAST_RELEASE_VERSION=$(curl -L https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq -r '.|=sort_by(.name)|.[-1].name' | sed 's|v||') | ||
echo "Last release version: ${LAST_RELEASE_VERSION}" | ||
|
||
MAIN_COMMIT=$(git rev-parse origin/main) | ||
echo "Main commit: ${MAIN_COMMIT}" | ||
LAST_RELEASE_BRANCH="release-${LAST_RELEASE_VERSION}" | ||
LAST_RELEASE_COMMIT=$(git rev-parse "origin/$LAST_RELEASE_BRANCH") | ||
echo "Last release commit: ${LAST_RELEASE_COMMIT}" | ||
|
||
if [ "$MAIN_COMMIT" = "$LAST_RELEASE_COMMIT" ]; then echo "Hash commit in main branch matches the last release branch commit" && exit 1; fi | ||
|
||
echo "COMMIT_NAME=$COMMIT_NAME" >> "$GITHUB_ENV" | ||
echo "LAST_RELEASE_VERSION=$LAST_RELEASE_VERSION" >> "$GITHUB_ENV" | ||
- name: 'Make new release version number' | ||
run: | | ||
npm version "$LAST_RELEASE_VERSION" --no-git-tag-version --allow-same-version | ||
|
||
TAG_NEW_VERSION=$(npm version minor --no-git-tag-version --allow-same-version) | ||
NEW_VERSION=$(echo $TAG_NEW_VERSION | sed 's|v||') | ||
|
||
echo "NEW_VERSION=$NEW_VERSION" >> "$GITHUB_ENV" | ||
echo "TAG_NEW_VERSION=$TAG_NEW_VERSION" >> "$GITHUB_ENV" | ||
- name: 'Create new release branch' | ||
run: | | ||
NEW_BRANCH="release-$NEW_VERSION" | ||
|
||
git checkout -b "$NEW_BRANCH" | ||
echo "Created new release branch: $NEW_BRANCH" | ||
|
||
echo "NEW_BRANCH=$NEW_BRANCH" >> "$GITHUB_ENV" | ||
- name: 'Commit package version' | ||
run: | | ||
git config user.email "" && git config user.name "GitHub Release" | ||
git add package.json && git add package-lock.json && git commit -am "Bump version to $NEW_VERSION [release]" | ||
git push --set-upstream origin "$NEW_BRANCH" | ||
- uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ env.TAG_NEW_VERSION }} | ||
release_name: ${{ env.TAG_NEW_VERSION }} | ||
commitish: ${{ env.NEW_BRANCH }} | ||
body: ${{ env.COMMIT_NAME }} | ||
draft: false | ||
prerelease: false | ||
- name: 'Success notify' | ||
run: echo "Version bumped to '$TAG_NEW_VERSION' and pushed to remote repository" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
on: | ||
push: | ||
branches: | ||
- 'release-**' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
name: Publish Platform Hotfix | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
if: "!contains(github.event.commits[0].message, '[hotfix]') && !contains(github.event.commits[0].message, '[release]')" | ||
name: datalens-us | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: . | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: 'npm' | ||
- name: 'Get current release' | ||
run: | | ||
COMMIT_NAME=$(git log -n 1 --pretty=format:%s) | ||
|
||
RELEASE_BRANCH="$GITHUB_REF_NAME" | ||
RELEASE_VERSION=$(echo $RELEASE_BRANCH | sed 's|release-||') | ||
echo "Release version: ${RELEASE_VERSION}" | ||
|
||
echo "COMMIT_NAME=$COMMIT_NAME" >> "$GITHUB_ENV" | ||
- name: 'Make new release version number' | ||
run: | | ||
TAG_NEW_VERSION=$(npm version patch --no-git-tag-version --allow-same-version) | ||
NEW_VERSION=$(echo $TAG_NEW_VERSION | sed 's|v||') | ||
|
||
echo "NEW_VERSION=$NEW_VERSION" >> "$GITHUB_ENV" | ||
echo "TAG_NEW_VERSION=$TAG_NEW_VERSION" >> "$GITHUB_ENV" | ||
- name: 'Commit package version' | ||
run: | | ||
git config user.email "" && git config user.name "GitHub Release" | ||
git add package.json && git add package-lock.json && git commit -am "Bump version to $NEW_VERSION [hotfix]" | ||
git push | ||
- uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ env.TAG_NEW_VERSION }} | ||
release_name: ${{ env.TAG_NEW_VERSION }} | ||
commitish: ${{ env.GITHUB_REF_NAME }} | ||
body: ${{ env.COMMIT_NAME }} | ||
draft: false | ||
prerelease: false | ||
- name: 'Success notify' | ||
run: echo "Version bumped to '$TAG_NEW_VERSION' and pushed to remote repository" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to open file
.env
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied from
datalens-ui
repo, i gues for creating empty fileThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's strange, because below writeFileSync have called with default flag
w