Skip to content

Commit

Permalink
Simplify the workflow and make sure we are using git to checkout
Browse files Browse the repository at this point in the history
Use the build-in way to add a token. Use pushd/popd to keep the working directory.
  • Loading branch information
tintou committed Jul 19, 2022
1 parent 9912a08 commit 32d44a6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 54 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/weekly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,28 @@ jobs:
image: elementary/docker:juno-stable

steps:
- name: Install git
run: |
add-apt-repository ppa:git-core/ppa -y
apt-get update
apt-get install git -y
- name: Clone repository
uses: actions/checkout@v3
with:
token: ${{ secrets.GIT_USER_TOKEN }}

- name: Build metadata
run: |
ln -s $GITHUB_WORKSPACE /repo
./build.sh focal stable
- name: Push metadata
run: |
./commit.sh
git config --global user.name "$GIT_USER_NAME"
git config --global user.email "$GIT_USER_EMAIL"
git add .
git commit -m "Automatic update of metadata"
git push
env:
GIT_USER_TOKEN: "${{ secrets.GIT_USER_TOKEN }}"
GIT_USER_NAME: "elementaryBot"
GIT_USER_EMAIL: "[email protected]"
33 changes: 20 additions & 13 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ EOF

apt-mirror

mkdir /workdir
cd /workdir
APPSTREAM_DIR=/workdir
mkdir ${APPSTREAM_DIR}
pushd ${APPSTREAM_DIR}

cat <<EOF > asgen-config.json
{
Expand All @@ -40,30 +41,36 @@ EOF

appstream-generator process ${DIST}

popd

# Clear out the old data
rm -rf /repo/pantheon-data/main/*
rm -f /repo/debian/appstream-data-pantheon-icons-hidpi.install
rm -f /repo/debian/appstream-data-pantheon-icons.install
touch /repo/debian/appstream-data-pantheon-icons-hidpi.install
touch /repo/debian/appstream-data-pantheon-icons.install
rm -rf pantheon-data/main/*
rm -f debian/appstream-data-pantheon-icons-hidpi.install
rm -f debian/appstream-data-pantheon-icons.install
touch debian/appstream-data-pantheon-icons-hidpi.install
touch debian/appstream-data-pantheon-icons.install

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

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

# Strip a path like export/data/bionic/main/[email protected] down to 128x128@2
OUTDIR=`basename ${f} .tar.gz | cut -d- -f2`
mkdir -p /repo/pantheon-data/main/icons/${OUTDIR}
tar -C /repo/pantheon-data/main/icons/${OUTDIR} -xf ${f}
mkdir -p pantheon-data/main/icons/${OUTDIR}
tar -C pantheon-data/main/icons/${OUTDIR} -xf ${f}

# Add the extracted directory path to the debian install scripts (either HiDPI or not)
if [[ $OUTDIR == *"@2" ]]; then
echo "pantheon-data/main/icons/${OUTDIR}/* usr/share/app-info/icons/elementary-${CHANNEL}-${DIST}-main/$OUTDIR/" >> /repo/debian/appstream-data-pantheon-icons-hidpi.install
echo "pantheon-data/main/icons/${OUTDIR}/* usr/share/app-info/icons/elementary-${CHANNEL}-${DIST}-main/$OUTDIR/" >> debian/appstream-data-pantheon-icons-hidpi.install
else
echo "pantheon-data/main/icons/${OUTDIR}/* usr/share/app-info/icons/elementary-${CHANNEL}-${DIST}-main/$OUTDIR/" >> /repo/debian/appstream-data-pantheon-icons.install
echo "pantheon-data/main/icons/${OUTDIR}/* usr/share/app-info/icons/elementary-${CHANNEL}-${DIST}-main/$OUTDIR/" >> debian/appstream-data-pantheon-icons.install
fi
done

# Change the ownership to the current user
chown -R $(id -u):$(id -g) pantheon-data
chown -R $(id -u):$(id -g) debian
38 changes: 0 additions & 38 deletions commit.sh

This file was deleted.

0 comments on commit 32d44a6

Please sign in to comment.