meli-cli/.github/workflows/main.yml

58 lines
2.1 KiB
YAML

name: main
on: [ push, pull_request ]
env:
GITHUB_REPOSITORY_SSH_URL: "git@github.com:${{ github.repository }}.git"
IS_RELEASE_BRANCH: "${{ github.ref == 'refs/heads/latest' || github.ref == 'refs/heads/next' || github.ref == 'refs/heads/beta' }}"
GIT_AUTHOR_NAME: "meli-release-bot"
GIT_COMMITTER_NAME: "meli-release-bot"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12'
- name: "install dependencies"
run: npm ci
- name: "create VERSION file"
if: ${{ env.IS_RELEASE_BRANCH == 'true' }}
run: |
source ./scripts/setup-git.sh "$RELEASE_DEPLOY_KEY"
echo $GITHUB_REPOSITORY_SSH_URL
npx semantic-release -r $GITHUB_REPOSITORY_SSH_URL -d
echo "Next release version is $(cat VERSION)"
env:
RELEASE_DEPLOY_KEY: ${{ secrets.RELEASE_DEPLOY_KEY }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: "Lint"
run: npm run lint
- name: "test"
run: npm run test
- name: "build"
run: |
if [ -f VERSION ]; then
npm version --no-git-tag-version $(cat VERSION) --allow-same-version
fi
npm run build
- name: "release"
if: ${{ env.IS_RELEASE_BRANCH == 'true' }}
run: |
source ./scripts/setup-git.sh "$RELEASE_DEPLOY_KEY"
# allow publishing scoped package as public to avoid 402
npm config set access public
npx semantic-release -r $GITHUB_REPOSITORY_SSH_URL
env:
RELEASE_DEPLOY_KEY: ${{ secrets.RELEASE_DEPLOY_KEY }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: "realign next"
if: ${{ env.IS_RELEASE_BRANCH == 'true' }}
run: |
source ./scripts/setup-git.sh "$RELEASE_DEPLOY_KEY"
HEAD_BRANCH=`echo "${GITHUB_REF//refs\/heads\//}" | tr -d '\n'`
./scripts/rebase-git-branch.sh "next" "$HEAD_BRANCH"
env:
RELEASE_DEPLOY_KEY: ${{ secrets.RELEASE_DEPLOY_KEY }}