Merge pull request #115 from ReconVirus/dependabot/npm_and_yarn/sass-… #95
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: Build, Tag and Release | |
on: | |
push: | |
branches: | |
- Main | |
env: | |
ARTIFACT_PATH: ./dist/ | |
ZIP_FILE_NAME: Release | |
jobs: | |
build: | |
name: Build release artifacts | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
- name: Cache node modules | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- run: | | |
npm ci | |
npm run build | |
cp ./manifest.json ./dist/ | |
shell: pwsh | |
- uses: actions/upload-artifact@v3.1.3 | |
with: | |
name: Release | |
path: ./dist | |
tag_and_release: | |
needs: build | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
- name: Download artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: Release | |
path: ./Release | |
- name: Create zip file | |
run: | | |
Compress-Archive -Path ./Release/* -DestinationPath ./${{ env.ZIP_FILE_NAME }}.zip | |
shell: pwsh | |
- id: set_tag_and_push | |
shell: pwsh | |
run: | | |
$VERSION = (Get-Content package.json | ConvertFrom-Json).version | |
$NEW_TAG = "v$VERSION" | |
echo "latest_tag=$NEW_TAG" | Out-File -FilePath $env:GITHUB_ENV -Append | |
git remote set-url origin "https://x-access-token:${{ secrets.MASTER }}@github.com/ReconVirus/Historium.git" | |
git tag $NEW_TAG | |
git push origin $NEW_TAG | |
- id: create_release_and_upload_asset | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.MASTER }} | |
with: | |
tag_name: ${{ env.latest_tag }} | |
release_name: Release ${{ env.latest_tag }} | |
body_path: CHANGELOG.md | |
draft: false | |
prerelease: false | |
- name: Upload Release | |
run: | | |
echo "Uploading ./${{ env.ZIP_FILE_NAME }}.zip" | |
gh release upload ${{ env.latest_tag }} ./${{ env.ZIP_FILE_NAME }}.zip --clobber | |
shell: bash | |
env: | |
GH_TOKEN: ${{ secrets.MASTER }} |