Upload File Plugins Release Process #291
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: Upload File Plugins Release Process | |
on: | |
workflow_dispatch: | |
inputs: | |
fileName: | |
type: string | |
description: File Name (ucv-ext-abc:1.0.0) | |
required: true | |
folderName: | |
type: string | |
description: Folder Name (ucv-ext-abc) | |
required: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check disk space | |
run: df -h | |
- name: Free disk space | |
run: | | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
- name: Create Folder | |
run: | | |
sudo mkdir -p /mnt/docker/tmp | |
echo "TMPDIR=/mnt/docker/tmp" >> $GITHUB_ENV | |
sudo mv /var/lib/docker/tmp /mnt/docker/tmp.old || true | |
sudo ln -s /mnt/docker/tmp /var/lib/docker/tmp | |
sudo mkdir /mnt/docker/files | |
sudo mkdir "/mnt/docker/files/${{ github.event.inputs.folderName }}" | |
- name: Docker Pull Image | |
run: | | |
docker pull "urbancode/${{ github.event.inputs.fileName }}" | |
- name: Set up repository | |
run: | | |
git init | |
git remote add origin https://github.com/${{ github.repository }} | |
git config core.sparseCheckout true | |
echo "files/${{ github.event.inputs.folderName }}" > .git/info/sparse-checkout | |
git pull origin ${{ github.ref }} | |
- name: Docker Save as TAR | |
run: | | |
whoami | |
df -h | |
ls -ltra | |
sudo docker save -o /mnt/docker/"${{ github.event.inputs.fileName }}.tar" "urbancode/${{ github.event.inputs.fileName }}" | |
ls -a | |
sudo mkdir -p "/mnt/docker/files/${{ github.event.inputs.folderName }}" | |
sudo mv "/mnt/docker/${{ github.event.inputs.fileName }}.tar" "/mnt/docker/files/${{ github.event.inputs.folderName }}/" | |
cd /mnt/docker/files/${{ github.event.inputs.folderName }}/ | |
sudo chown runner:docker /mnt/docker/files/${{ github.event.inputs.folderName }}/ | |
ls -lh "/mnt/docker/files/${{ github.event.inputs.folderName }}/${{ github.event.inputs.fileName }}.tar" | |
- name: Install 7zip | |
run: sudo apt-get update && sudo apt-get install -y p7zip-full | |
- name: Execute 7zip | |
run: | | |
sudo 7z a -v50m "/home/runner/work/IBM-UCV-PLUGINS/IBM-UCV-PLUGINS/files/${{ github.event.inputs.folderName }}/${{ github.event.inputs.fileName }}.tar.7z" "/mnt/docker/files/${{ github.event.inputs.folderName }}/${{ github.event.inputs.fileName }}.tar" | |
- name: Commit changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
pwd | |
ls -lRa /mnt/docker/files/${{ github.event.inputs.folderName }}/ | |
echo "The path in which git initialization executing: " | |
sudo chown -R runner:docker files | |
ls -lRa | |
git init | |
git config --global user.email "madhavaraoku@hcl.com" | |
git config --global user.name "madhavbk" | |
git add *.00* | |
git commit -m "adding ${{ github.event.inputs.fileName }}" | |
git branch -M main | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | |
git push -u origin main | |
docker system prune -af --volumes |