Skip to content

Commit 32d44a6

Browse files
committed
Simplify the workflow and make sure we are using git to checkout
Use the build-in way to add a token. Use pushd/popd to keep the working directory.
1 parent 9912a08 commit 32d44a6

3 files changed

Lines changed: 33 additions & 54 deletions

File tree

.github/workflows/weekly-build.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,28 @@ jobs:
1313
image: elementary/docker:juno-stable
1414

1515
steps:
16+
- name: Install git
17+
run: |
18+
add-apt-repository ppa:git-core/ppa -y
19+
apt-get update
20+
apt-get install git -y
21+
1622
- name: Clone repository
1723
uses: actions/checkout@v3
24+
with:
25+
token: ${{ secrets.GIT_USER_TOKEN }}
1826

1927
- name: Build metadata
2028
run: |
21-
ln -s $GITHUB_WORKSPACE /repo
2229
./build.sh focal stable
2330
2431
- name: Push metadata
2532
run: |
26-
./commit.sh
33+
git config --global user.name "$GIT_USER_NAME"
34+
git config --global user.email "$GIT_USER_EMAIL"
35+
git add .
36+
git commit -m "Automatic update of metadata"
37+
git push
2738
env:
28-
GIT_USER_TOKEN: "${{ secrets.GIT_USER_TOKEN }}"
2939
GIT_USER_NAME: "elementaryBot"
3040
GIT_USER_EMAIL: "builds@elementary.io"

build.sh

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ EOF
1818

1919
apt-mirror
2020

21-
mkdir /workdir
22-
cd /workdir
21+
APPSTREAM_DIR=/workdir
22+
mkdir ${APPSTREAM_DIR}
23+
pushd ${APPSTREAM_DIR}
2324

2425
cat <<EOF > asgen-config.json
2526
{
@@ -40,30 +41,36 @@ EOF
4041

4142
appstream-generator process ${DIST}
4243

44+
popd
45+
4346
# Clear out the old data
44-
rm -rf /repo/pantheon-data/main/*
45-
rm -f /repo/debian/appstream-data-pantheon-icons-hidpi.install
46-
rm -f /repo/debian/appstream-data-pantheon-icons.install
47-
touch /repo/debian/appstream-data-pantheon-icons-hidpi.install
48-
touch /repo/debian/appstream-data-pantheon-icons.install
47+
rm -rf pantheon-data/main/*
48+
rm -f debian/appstream-data-pantheon-icons-hidpi.install
49+
rm -f debian/appstream-data-pantheon-icons.install
50+
touch debian/appstream-data-pantheon-icons-hidpi.install
51+
touch debian/appstream-data-pantheon-icons.install
4952

5053
# Copy in the new
51-
cp export/data/${DIST}/main/Components-amd64.yml.gz /repo/pantheon-data/main/pantheon_${DIST}-main_amd64.yml.gz
52-
for f in export/data/${DIST}/main/icons-*; do
54+
cp ${APPSTREAM_DIR}/export/data/${DIST}/main/Components-amd64.yml.gz pantheon-data/main/pantheon_${DIST}-main_amd64.yml.gz
55+
for f in ${APPSTREAM_DIR}/export/data/${DIST}/main/icons-*; do
5356

5457
# Ignore icon archives with no icons
5558
FILECOUNT=$(tar -tzvvf ${f} | grep -c ^-) || true
5659
[[ $FILECOUNT -gt 0 ]] || continue
5760

5861
# Strip a path like export/data/bionic/main/icons-128x128@2.tar.gz down to 128x128@2
5962
OUTDIR=`basename ${f} .tar.gz | cut -d- -f2`
60-
mkdir -p /repo/pantheon-data/main/icons/${OUTDIR}
61-
tar -C /repo/pantheon-data/main/icons/${OUTDIR} -xf ${f}
63+
mkdir -p pantheon-data/main/icons/${OUTDIR}
64+
tar -C pantheon-data/main/icons/${OUTDIR} -xf ${f}
6265

6366
# Add the extracted directory path to the debian install scripts (either HiDPI or not)
6467
if [[ $OUTDIR == *"@2" ]]; then
65-
echo "pantheon-data/main/icons/${OUTDIR}/* usr/share/app-info/icons/elementary-${CHANNEL}-${DIST}-main/$OUTDIR/" >> /repo/debian/appstream-data-pantheon-icons-hidpi.install
68+
echo "pantheon-data/main/icons/${OUTDIR}/* usr/share/app-info/icons/elementary-${CHANNEL}-${DIST}-main/$OUTDIR/" >> debian/appstream-data-pantheon-icons-hidpi.install
6669
else
67-
echo "pantheon-data/main/icons/${OUTDIR}/* usr/share/app-info/icons/elementary-${CHANNEL}-${DIST}-main/$OUTDIR/" >> /repo/debian/appstream-data-pantheon-icons.install
70+
echo "pantheon-data/main/icons/${OUTDIR}/* usr/share/app-info/icons/elementary-${CHANNEL}-${DIST}-main/$OUTDIR/" >> debian/appstream-data-pantheon-icons.install
6871
fi
6972
done
73+
74+
# Change the ownership to the current user
75+
chown -R $(id -u):$(id -g) pantheon-data
76+
chown -R $(id -u):$(id -g) debian

commit.sh

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)