generated from UniDash-Linux/pkg-template
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (76 loc) · 2.98 KB
/
auto_testing.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
78
79
80
81
82
83
84
85
86
87
on:
push:
branches:
- testing
jobs:
auto_ralease:
name: auto create and push release
runs-on: ubuntu-22.04
steps:
- uses: cachix/install-nix-action@v27
- name: Checkout repository
uses: actions/checkout@master
with:
ref: testing
- name: Generate Release version from date
id: date
run: |
TAG_NAME="testing-$(date +'%Y.%m.%d-%H.%M.%S')"
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
echo "Tag name will be: $TAG_NAME"
- name: Generate tar.gz from src
id: generate_tar
run: |
PKG_NAME="$(basename "${{ github.repository }}" | sed 's/pkg-//g')"
FILE_NAME="src-${PKG_NAME}.tar.gz"
echo "PKG_NAME=$PKG_NAME" >> $GITHUB_ENV
echo "FILE_NAME=$FILE_NAME" >> $GITHUB_ENV
tar -czvf ${FILE_NAME} src/
FILE_HASH=$(sha256sum ${FILE_NAME} | cut -d ' ' -f 1)
echo "FILE_HASH=$FILE_HASH" >> $GITHUB_ENV
- name: Generate package.nix
id: generate_package
run: |
URL=$(echo \
"https://github.com/${{ github.repository }}/releases/download/${{ env.TAG_NAME }}/${{ env.FILE_NAME }}" \
| sed 's/\//\\\//g'
)
SRC="src = fetchurl {\n url = \"${URL}\";\n sha256 = \"${{ env.FILE_HASH }}\";\n }"
sed -i "s/src = .\/src/src = .\/${{ env.FILE_NAME }}/g" ./package.nix
git add ./${{ env.FILE_NAME }}
nix build
git reset ./${{ env.FILE_NAME }}
sed -i "s/src = .\/${{ env.FILE_NAME }}/${SRC}/g" ./package.nix
sed -i "s/version = \".*\";/version = \"${{ env.TAG_NAME }}\";/g" ./package.nix
- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: ${{ env.TAG_NAME }}
tag_name: ${{ env.TAG_NAME }}
prerelease: true
files: |
./${{ env.FILE_NAME }}
./package.nix
- name: Clone RevoluNixPKGS
uses: actions/checkout@master
with:
ref: testing
repository: RevoluNix/revolunixpkgs
token: ${{ secrets.RevoluNixPKGS_TOKEN }}
- name: Update RevoluNixPKGS
id: update_pkgs
run: |
git config --global user.email "${{ github.event.pusher.email }}"
git config --global user.name "${{ github.event.pusher.name }}"
URL="https://github.com/${{ github.repository }}/releases/download/${{ env.TAG_NAME }}/package.nix"
rm -rf ./pkgs/${{ env.PKG_NAME }}
mkdir -p ./pkgs/${{ env.PKG_NAME }}
wget -O ./pkgs/${{ env.PKG_NAME }}/package.nix $URL
git add .
git commit -m "feat: Update/Upload ${{ env.PKG_NAME }} package"
- name: Push RevoluNixPKGS changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.RevoluNixPKGS_TOKEN }}
repository: RevoluNix/revolunixpkgs
branch: testing