Update build&release.yml #63
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 and Deploy | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Source Repository | |
uses: actions/checkout@v2 | |
- name: Cache NPM dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: npm-${{ hashFiles('**/*.lock') }} | |
restore-keys: | | |
npm- | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20' # Choose the Node.js version you need | |
- name: Install Dependencies | |
run: npm install | |
- name: Build | |
run: npm run build | |
- name: Create Zip Archive | |
run: | | |
cd dist | |
zip -r ../FRM-WebUI.zip . | |
- name: Deploy to FicsitRemoteMonitoring Repository | |
uses: actions/upload-artifact@v2 | |
with: | |
name: FRM-WebUI | |
path: FRM-WebUI.zip | |
- name: Checkout Target Repository | |
uses: actions/checkout@v2 | |
with: | |
repository: GalaxyVOID/FicsitRemoteMonitoring | |
- name: Download Zip File | |
uses: actions/download-artifact@v2 | |
with: | |
name: FRM-WebUI | |
- name: Unzip Contents | |
run: | | |
unzip FRM-WebUI.zip -d tmp | |
rm FRM-WebUI.zip | |
- name: Replace www Folder Contents | |
run: | | |
rm -rf ./www/* | |
mv ./tmp/* www | |
rm -rf ./tmp | |
- name: Set up SSH | |
run: | | |
mkdir -p ~/.ssh | |
echo "$DEPLOY_KEY" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
env: | |
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} | |
- name: Push to Repository | |
run: | | |
git config --global user.email "${{ secrets.EMAIL }}" | |
git config --global user.name "${{ secrets.USERNAME }}" | |
git remote add FicsitRemoteMonitoring [email protected]:GalaxyVOID/FicsitRemoteMonitoring.git | |
git add www | |
git commit -m "Automatic Push" | |
git push FicsitRemoteMonitoring main | |
env: | |
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} | |