-
-
Notifications
You must be signed in to change notification settings - Fork 4
104 lines (92 loc) · 3.14 KB
/
vib-build.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Vib Build
on:
push:
branches: [ "main" ]
schedule:
- cron: '21 * * * *'
workflow_dispatch:
env:
GITHUB_USER: ${{ github.actor }}
DIGEST_RELEASE_TAG: save-digest
jobs:
check_update:
runs-on: ubuntu-latest
outputs:
has_updates: ${{ steps.set_output.outputs.has_updates }}
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set requirement
run: echo "CHECK_UPDATES=${{ github.event_name == 'schedule'}}" >> "$GITHUB_ENV"
- name: Install dependencies
if: ${{ env.CHECK_UPDATES }}
run: sudo apt-get install jq
- name: Download previous digest
if: ${{ env.CHECK_UPDATES }}
continue-on-error: true
run: wget https://github.com/${{ github.repository }}/releases/download/${{ env.DIGEST_RELEASE_TAG }}/digest.txt
- name: Check if there was an update to the base image
if: ${{ env.CHECK_UPDATES }}
run: |
touch digest.txt
mv digest.txt last_digest.txt
curl https://differ.vanillaos.org/images/desktop > vanilla-image-info
jq -r '.image.releases[-1].digest' vanilla-image-info > digest.txt
echo Old digest is: $(cat last_digest.txt)
echo New digest is: $(cat digest.txt)
echo "HAS_UPDATES=$(cmp -s digest.txt last_digest.txt; echo $?)" >> "$GITHUB_ENV"
- name: Upload new digest
if: ${{ env.CHECK_UPDATES && env.HAS_UPDATES == 1 }}
uses: softprops/action-gh-release@v1
with:
token: "${{ secrets.GITHUB_TOKEN }}"
tag_name: "${{ env.DIGEST_RELEASE_TAG }}"
prerelease: true
name: "This keeps track of the current digest"
files: |
digest.txt
- name: Set output
id: set_output
run: |
if [ ${{env.CHECK_UPDATES}} == false ]
then
echo action was manually run, skipped update checking
echo "has_updates=true" >> "$GITHUB_OUTPUT"
elif [ ${{ env.HAS_UPDATES }} == 1 ]
then
echo base image was updated since last build
echo "has_updates=true" >> "$GITHUB_OUTPUT"
else
echo no updates to the base image since last build
echo "has_updates=false" >> "$GITHUB_OUTPUT"
fi
update:
runs-on: ubuntu-latest
needs: check_update
if: ${{ needs.check_update.outputs.has_updates == 'true' }}
steps:
- name: Upgrading
run: echo "Upgrading"
# build:
#
# runs-on: ubuntu-latest
#
# steps:
# - uses: actions/checkout@v4
#
# - uses: vanilla-os/[email protected]
# with:
# recipe: 'recipe.yml'
# plugins: 'Vanilla-OS/vib-fsguard:v1.2-1'
#
# - name: Build the Docker image
# run: docker image build -f Containerfile --tag ghcr.io/vanilla-os/desktop:main .
#
# # Push the image to GHCR (Image Registry)
# - name: Push To GHCR
# if: github.repository == 'vanilla-os/desktop-image'
# run: |
# docker login ghcr.io -u ${{ env.GITHUB_USER }} -p ${{ secrets.GITHUB_TOKEN }}
# docker image push "ghcr.io/vanilla-os/desktop:main"