Skip to content

Commit

Permalink
fix: Automate release
Browse files Browse the repository at this point in the history
  • Loading branch information
Arun-KumarH committed Apr 17, 2024
1 parent a09c2e7 commit 38aa831
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 75 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/approve-merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
git checkout master
git merge --ff origin/next
git push -u origin master
- uses: benc-uk/workflow-dispatch@v1
- uses: peter-evans/repository-dispatch@v3
with:
workflow: release.yaml
ref: master
event-type: release_master
22 changes: 0 additions & 22 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,3 @@ jobs:
- uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

image:
runs-on: ubuntu-22.04
needs: build
steps:
- uses: actions/checkout@v4

- uses: docker/setup-buildx-action@v3

- name: Set variables
id: vars
run: |
echo ::set-output name=version_tag::$(echo ${GITHUB_REF#refs/*/})
echo ::set-output name=repo_name::$(echo ${GITHUB_REPOSITORY#*/*})
- uses: docker/build-push-action@v5
with:
platforms: linux/amd64
build-args: |
APP_HOME=/home/node/${{ steps.vars.outputs.repo_name }}
cache-from: |
${{ github.repository }}:latest
76 changes: 26 additions & 50 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,69 +5,45 @@ on:
branches:
- master
workflow_dispatch:

permissions:
contents: read
types: [release_master]

jobs:
release:
permissions:
contents: write
issues: write
pull-requests: write
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: master

- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}

- uses: docker/setup-buildx-action@v3
with:
install: true

- name: Set variables
id: vars
run: |
echo ::set-output name=repo_name::$(echo ${GITHUB_REPOSITORY#*/*})
- uses: docker/metadata-action@v5
id: docker_meta
with:
images: ${{ github.repository }}

- uses: docker/build-push-action@v5
with:
load: true
build-args: |
APP_HOME=/home/node/${{ steps.vars.outputs.repo_name }}
tags: ${{ github.repository }}
labels: ${{ steps.docker_meta.outputs.labels }}

- uses: actions/setup-node@v4
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'

- name: Install Dependencies
run: npm clean-install

- run: npx [email protected]
- name: Git Config
run: |
git config --global user.email "[email protected]"
git config --global user.name "Restorecommerce Bot"
- name: Build
run: npm run build -- --verbose

- name: NPM Token
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" > .npmrc
- uses: benc-uk/workflow-dispatch@v1
with:
workflow: upgrade-services.yaml
ref: master
repo: restorecommerce/charts
token: "${{ secrets.CHARTS_WORKFLOW_TOKEN }}"
- name: Release
run: npx lerna publish --no-verify-access --no-private --conventional-commits --yes --loglevel debug

- name: Sync next branch
run: |
git checkout next
git merge master
git push -u origin next

0 comments on commit 38aa831

Please sign in to comment.