forked from adesutherland/vm-370
-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (69 loc) · 3.2 KB
/
dockerpush.yml
File metadata and controls
84 lines (69 loc) · 3.2 KB
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
78
79
80
81
82
83
84
name: DockerPublish
on:
push:
# Publish `v1.2.3` tags as releases.
tags:
- v*
jobs:
# Push image to GitHub Package Registry and create release with vm370 directory contents
push:
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- name: Build image
run: docker build . --file Dockerfile --tag image
- name: Extract /opt/hercules/vm370 files
if: startsWith(github.ref, 'refs/tags/')
run: |
mkdir -p "${{ runner.temp }}/vm370"
docker create -ti --name dummy image bash
docker cp "dummy:/opt/hercules/vm370/vm50-1.cckd" "${{ runner.temp }}/vm370/vm50-1.cckd"
docker cp "dummy:/opt/hercules/vm370/vm50-2.cckd" "${{ runner.temp }}/vm370/vm50-2.cckd"
docker cp "dummy:/opt/hercules/vm370/vm50-3.cckd" "${{ runner.temp }}/vm370/vm50-3.cckd"
docker cp "dummy:/opt/hercules/vm370/vm50-4.cckd" "${{ runner.temp }}/vm370/vm50-4.cckd"
docker cp "dummy:/opt/hercules/vm370/vm50-5.cckd" "${{ runner.temp }}/vm370/vm50-5.cckd"
docker cp "dummy:/opt/hercules/vm370/vm50-6.cckd" "${{ runner.temp }}/vm370/vm50-6.cckd"
docker cp "dummy:/opt/hercules/vm370/vm50-7.cckd" "${{ runner.temp }}/vm370/vm50-7.cckd"
docker cp "dummy:/opt/hercules/vm370/vm50-8.cckd" "${{ runner.temp }}/vm370/vm50-8.cckd"
docker cp "dummy:/opt/hercules/vm370/vm50u0.cckd" "${{ runner.temp }}/vm370/vm50u0.cckd"
docker cp "dummy:/opt/hercules/vm370/vm50u1.cckd" "${{ runner.temp }}/vm370/vm50u1.cckd"
docker cp "dummy:/opt/hercules/vm370/gccbrx.cckd" "${{ runner.temp }}/vm370/gccbrx.cckd"
docker rm -f dummy
zip -D -j -r vm370.zip "${{ runner.temp }}/vm370"
ls "${{ runner.temp }}/vm370"
- name: Create Release
if: startsWith(github.ref, 'refs/tags/')
id: create_release
uses: actions/create-release@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: true
- name: Upload Release Asset
if: startsWith(github.ref, 'refs/tags/')
id: upload-release-asset-ubuntu
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./vm370.zip
asset_name: vm370.zip
asset_content_type: application/zip
- name: Log into docker
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Push image to docker
run: |
IMAGE_ID=${{ secrets.DOCKER_USERNAME }}/vm370
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
VERSION=$(echo $VERSION | sed -e 's/^v//')
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag image $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION