create v3.0.0 #2
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
name: Tag and Build | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
tag: | |
name: Tag | |
runs-on: ubuntu-latest | |
outputs: | |
new_tag: ${{ steps.tag.outputs.new_tag }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get current version from package.json | |
id: version | |
run: echo "version=$(jq -r .version package.json)" >> $GITHUB_OUTPUT | |
- name: Check if tag already exists | |
id: check | |
run: | | |
if git rev-list -n 1 "v${{ steps.version.outputs.version }}"; then | |
echo "exists=true" >> $GITHUB_OUTPUT | |
else | |
echo "exists=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Tag new version | |
id: tag | |
if: ${{ steps.check.outputs.exists == 'false' }} | |
uses: mathieudutour/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
custom_tag: ${{ steps.version.outputs.version }} | |
build: | |
name: Build project | |
runs-on: ubuntu-latest | |
needs: tag | |
if: ${{ needs.tag.outputs.new_tag }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Compress dist as tar.gz | |
run: tar -czf bmc-ui-${{ needs.tag.outputs.new_tag }}.tar.gz dist | |
- name: Release | |
uses: ncipollo/release-action@v1 | |
with: | |
name: BMC-UI ${{ needs.tag.outputs.new_tag }} | |
tag: ${{ needs.tag.outputs.new_tag }} | |
artifacts: bmc-ui-${{ needs.tag.outputs.new_tag }}.tar.gz | |
body: | | |
This is an automated release build by GitHub Actions, intended to be used in the BMC-Firmware build process. | |
For more details, please see the logs [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}). |