Repository navigation
107 lines (91 loc) · 3.02 KB
/
Copy pathrelease.yml
File metadata and controls
107 lines (91 loc) · 3.02 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Release
on:
push:
tags:
- "v*.*.*"
permissions:
contents: write
packages: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Free disk space
run: |
echo '===== Before ====='
df -h
sudo rm -rf /opt/hostedtoolcache/go
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo rm -rf /usr/lib/google-cloud-sdk
sudo rm -rf /usr/local/julia*
sudo rm -rf /usr/local/.ghcup
sudo rm -rf /usr/share/swift
sudo rm -rf /usr/share/dotnet
sudo apt-get clean
echo '===== After ====='
df -h
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get version from tag
id: get_version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "tag_name=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
- name: Log in to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/mes:latest
ghcr.io/${{ github.repository_owner }}/mes:${{ steps.get_version.outputs.version }}
ghcr.io/${{ github.repository_owner }}/mes:${{ github.sha }}
platforms: linux/amd64,linux/arm64
- name: Create release notes with Docker image info
id: release_notes
run: |
cat << EOF > release_notes.md
## Docker Image
This release includes the Docker image:
\`\`\`
ghcr.io/${{ github.repository_owner }}/mes:latest
ghcr.io/${{ github.repository_owner }}/mes:${{ steps.get_version.outputs.version }}
\`\`\`
Pull the latest image:
\`\`\`bash
docker pull ghcr.io/${{ github.repository_owner }}/mes:latest
\`\`\`
Pull a specific version:
\`\`\`bash
docker pull ghcr.io/${{ github.repository_owner }}/mes:${{ steps.get_version.outputs.version }}
\`\`\`
EOF
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
body_path: release_notes.md
generate_release_notes: true
draft: false
prerelease: false
name: Release v${{ steps.get_version.outputs.version }}
tag_name: ${{ steps.get_version.outputs.tag_name }}
target_commitish: ${{ github.sha }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Dump disk usage on failure
if: failure()
run: |
df -h
du -xh / --max-depth=3 2>/dev/null | sort -h | tail -50