Skip to content

Commit

Permalink
ci: deploy even if already released
Browse files Browse the repository at this point in the history
  • Loading branch information
sohrab- committed Jul 21, 2022
1 parent 55ec85e commit 391f0aa
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 61 deletions.
50 changes: 31 additions & 19 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ on:
branches: [ alpha ]

jobs:
deployProd:
build:
runs-on: ubuntu-latest
environment: prod
steps:
# setup
- uses: actions/checkout@v3
Expand All @@ -15,33 +14,46 @@ jobs:
with:
node-version: 16.x
- run: npm ci


# determine version
- id: semantic-version
run: npm run release --dry-run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# default to the latest tag version if no new release
- id: version
run: |
if [[ '${{ steps.semantic-version.outputs.new-release-published == 'true' }}' ]]; then
echo '::set-output name=version::${{ steps.semantic-version.outputs.new-release-version }}'
else
LATEST_TAG=$(git describe --abbrev=0 --tags | tr -d v)
echo "::set-output name=version::${LATEST_TAG}"
fi
# test
# TODO
# - run: npm test
# - run: npm run lint

# determine version
- run: |
npm run release && \
REACT_APP_VERSION="$(cat .version | tr -d '\n') (Build ${GITHUB_RUN_NUMBER}-${GITHUB_RUN_ATTEMPT})"
echo "REACT_APP_VERSION=$REACT_APP_VERSION" >> $GITHUB_ENV
env:
CI_VERSION_ONLY: 1
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# build
- run: npm run build
# TODO uncomment before public release
# env:
# GENERATE_SOURCEMAP: false
env:
# TODO uncomment before public release?
# GENERATE_SOURCEMAP: false
REACT_APP_VERSION: "${{ steps.version.outputs.version }} (Build ${GITHUB_RUN_NUMBER}-${GITHUB_RUN_ATTEMPT})"

# version
# release
- run: npm run release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# deploy
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# TODO deployDev

deployProd:
runs-on: ubuntu-latest
environment: prod
needs: build
steps:
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
Expand Down
23 changes: 23 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"defaultBranch": "main",
"branches": [
"+([0-9])?(.{+([0-9]),x}).x",
"main",
"next",
"next-major",
{
"name": "beta",
"prerelease": true
},
{
"name": "alpha",
"prerelease": true
}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"semantic-release-export-data",
"@semantic-release/github"
]
}
19 changes: 18 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"@types/uuid": "^8.3.4",
"react-app-rewired": "^2.2.1",
"react-scripts": "5.0.1",
"semantic-release": "^19.0.3"
"semantic-release": "^19.0.3",
"semantic-release-export-data": "^1.0.0"
}
}
40 changes: 0 additions & 40 deletions release.config.js

This file was deleted.

0 comments on commit 391f0aa

Please sign in to comment.