-
Notifications
You must be signed in to change notification settings - Fork 17
feat: remove circleci, add release github action, update ci.Dockerfile [MDS-1702] #876
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
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5ed119b
feat: remove circleci, add release github action, update ci.Dockerfile
ethenne 277ea01
fix: remove circle ci from ci build
ethenne 7b2d7d7
fix: update scripts
ethenne 3b21b5d
fix: add env var for semantic release
ethenne 657e2fa
fix/add EOF
ethenne cca42a9
Merge branch 'main' into MDS-1702
ethenne 03ce193
fix: improve scripts
ethenne e7b4eae
Merge branch 'main' into MDS-1702
ethenne 38c9fd8
fix: improve scripts
ethenne 38a681a
fix: EOF has been added
ethenne 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 was deleted.
Oops, something went wrong.
This file contains hidden or 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,27 @@ | ||
| name: Setup Elixir App | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - uses: erlef/setup-elixir@v1 | ||
| with: | ||
| elixir-version: '1.15' | ||
| otp-version: '26' | ||
|
|
||
| - uses: actions/cache@v4 | ||
| with: | ||
| path: deps | ||
| key: ${{ runner.os }}-deps-${{ hashFiles('**/mix.lock') }} | ||
|
|
||
| - uses: actions/cache@v4 | ||
| with: | ||
| path: _build | ||
| key: ${{ runner.os }}-build-${{ github.sha }} | ||
|
|
||
| - run: mix deps.get | ||
| shell: bash | ||
|
|
||
| - run: mix compile --warnings-as-errors | ||
| shell: bash | ||
|
|
||
|
|
||
This file contains hidden or 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,42 @@ | ||
| name: Build and Test | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Elixir | ||
| uses: ./.github/actions/setup_elixir | ||
|
|
||
| - name: Run tests | ||
| run: mix test | ||
|
|
||
| - name: Read VERSION file and create tag | ||
| if: github.ref == 'refs/heads/main' && success() | ||
| run: | | ||
| TAG="v$(cat VERSION | tr -d '[:space:]')" | ||
| echo "Using tag: $TAG" | ||
|
|
||
| git config user.name "github-actions" | ||
| git config user.email "github-actions@github.com" | ||
|
|
||
| git fetch --tags | ||
|
|
||
| if git rev-parse "$TAG" >/dev/null 2>&1; then | ||
| echo "Tag $TAG already exists. Skipping." | ||
| else | ||
| git tag "$TAG" | ||
| git push origin "$TAG" | ||
| echo "Tag $TAG pushed." | ||
| fi |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,49 +1,73 @@ | ||
| name: build | ||
| name: Release Docker Image | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| tags: | ||
| - 'v*' | ||
|
|
||
| jobs: | ||
| tag-release: | ||
| release: | ||
| name: Build, Push Docker Image, and Deploy | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| release-version: ${{ steps.release-version.outputs.version }} | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| # Tag new release | ||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v4 | ||
| - name: Log in to Docker Hub | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| node-version: 14 | ||
| username: ${{ secrets.DOCKER_USER }} | ||
| password: ${{ secrets.DOCKER_PASS }} | ||
|
|
||
| - name: Build and push docker image | ||
| env: | ||
| MIX_ENV: prod | ||
| APP_NAME: moon | ||
| SERVICE_NAME: moon | ||
| DOCKER_ORG: ${{ secrets.DOCKER_USER }} | ||
| APP_VSN: ${{ github.ref_name }} | ||
| run: | | ||
| scripts/deploy/docker-build push $APP_VSN | ||
|
|
||
| - name: Install Semantic Release, plugins and preset | ||
| working-directory: . | ||
| - name: Setup robot SSH key | ||
| run: | | ||
| npm install -g \ | ||
| semantic-release@18.0.0 \ | ||
| conventional-changelog-conventionalcommits@4.6.1 | ||
|
|
||
| # - name: Run Sematic Release | ||
| # working-directory: . | ||
| # env: | ||
| # GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| # run: semantic-release --branches main | ||
|
|
||
| # # Get new release version | ||
| # - name: Get release tag | ||
| # id: release-tag | ||
| # uses: WyriHaximus/github-action-get-previous-tag@v1.1 | ||
|
|
||
| # - name: Get release version | ||
| # id: release-version | ||
| # uses: actions/github-script@v6 | ||
| # with: | ||
| # script: | | ||
| # core.setOutput( | ||
| # 'version', | ||
| # '${{ steps.release-tag.outputs.tag }}'.slice(1) | ||
| # ) | ||
| echo "$ROBOT_SSH_KEY" | base64 -d > $HOME/.ssh/id_rsa.robot | ||
| chmod 600 $HOME/.ssh/id_rsa.robot | ||
| echo -e "Host *\n IdentityFile $HOME/.ssh/id_rsa.robot\n IdentitiesOnly yes" > $HOME/.ssh/config | ||
| eval "$(ssh-agent -s)" && ssh-add $HOME/.ssh/id_rsa.robot | ||
|
|
||
| - name: Setup deploy tool auth | ||
| run: echo "{\"user\":\"$DEPLOY_USER\", \"pass\":\"$DEPLOY_PASS\"}" > $HOME/.deploy_auth | ||
|
|
||
| - name: Deploy | ||
| run: ./scripts/deploy/stacks-deploy ${{ github.ref_name }} | ||
|
|
||
| - name: Restore node_modules cache | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: node_modules | ||
| key: v13-node_modules-${{ hashFiles('package-lock.json') }} | ||
| restore-keys: | | ||
| v13-node_modules- | ||
|
|
||
| - name: Restore mix.lock cache | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: _build | ||
| key: v13-build_test-${{ hashFiles('mix.lock') }} | ||
| restore-keys: | | ||
| v13-build_test- | ||
|
|
||
| - name: Hex auth | ||
| run: mix hex.organization auth coingaming --key $HEX_API_KEY | ||
|
|
||
| - name: Semantic Release | ||
| env: | ||
| MIX_ENV: test | ||
| run: mix semantic.release | ||
|
|
||
| - name: Save node_modules cache | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: node_modules | ||
| key: v13-node_modules-${{ hashFiles('package-lock.json') }} |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.