-
Notifications
You must be signed in to change notification settings - Fork 1
69 lines (61 loc) · 2.14 KB
/
bash.yml
File metadata and controls
69 lines (61 loc) · 2.14 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
name: bash
on: [workflow_dispatch]
jobs:
build:
runs-on: ubuntu-latest
outputs:
ssha: ${{ steps.ssha.outputs.ssha }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Compile and extract artifacts from docker container
run: |
sudo apt install jo jq
mkdir -p dist
for arch in x86_64; do
docker build --platform "${arch}" -f bash.dockerfile -t bash:latest .
docker run --rm --platform "${arch}" \
-v $(pwd):/workdir \
bash:latest \
cp /dist/bash "/workdir/dist/bash-${arch}"
SHA="$(sha256sum ./dist/bash-${arch} | awk '{print $1}')"
./metadata.sh --version "$(./dist/bash-${arch} --version | head -n1 | awk '{print $4}')" \
--license GPL-3.0 "https://www.gnu.org/licenses/gpl.html" \
--source "http://ftpmirror.gnu.org/gnu/bash/bash-5.3.tar.gz" \
--sha "$SHA" > ./dist/bash-metadata.json
done
- name: Set permissions for dist directory
run: |
sudo chown -R "$(id -u)":"$(id -g)" dist/
sudo chmod -R 755 dist/
- name: Upload artifacts to release
uses: actions/upload-artifact@v4
with:
name: dist
path: 'dist'
- name: Compute Short SHA
id: ssha
run: |
echo "ssha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
release:
permissions: write-all
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: dist
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: |
TAG=${GITHUB_SHA::7}
# Create release if it doesn't exist; ignore error if it does
gh release create "$TAG" --title "Release $TAG" --notes "Automated" --target "$GITHUB_SHA" || true
# Upload/replace the asset(s)
gh release upload "$TAG" bash-* --clobber