-
Notifications
You must be signed in to change notification settings - Fork 6
77 lines (75 loc) · 3.2 KB
/
uploadFile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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