Skip to content

Commit

Permalink
Try using a custom container
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickpeterse committed Oct 30, 2023
1 parent d8ae688 commit 6c7bc0e
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 33 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Container
on:
push:
branches:
- main
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
container:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v4
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
12 changes: 2 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,21 @@ jobs:
test:
runs-on: ubuntu-latest
container:
image: archlinux:latest
image: ghcr.io/inko-lang/aur:latest
steps:
- uses: actions/checkout@v4
- name: Installing dependencies
run: bash scripts/deps.sh
- name: Creating build user
run: bash scripts/user.sh
- name: Running tests
run: bash scripts/test.sh "${{ github.event.inputs.name }}"
release:
needs:
- test
runs-on: ubuntu-latest
container:
image: archlinux:latest
image: ghcr.io/inko-lang/aur:latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Installing dependencies
run: bash scripts/deps.sh
- name: Creating build user
run: bash scripts/user.sh
- name: Updating PKGBUILD
run: |
bash scripts/update.sh inko "${{ github.event.inputs.version }}"
Expand Down
10 changes: 10 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM archlinux:latest

RUN pacman -Syu --noconfirm --noprogress pacman-contrib base-devel bash git \
sudo openssh

RUN useradd --no-create-home build \
&& echo 'build ALL=(ALL:ALL) ALL' > /etc/sudoers.d/build

USER build
CMD ["/usr/bin/bash"]
4 changes: 0 additions & 4 deletions scripts/deps.sh

This file was deleted.

9 changes: 1 addition & 8 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ then
fi

cd "${name}"

if [[ -v CI ]]
then
sudo -u build makepkg --cleanbuild --force --noconfirm --clean
else
makepkg --cleanbuild --force --noconfirm --clean
fi

makepkg --cleanbuild --force --noconfirm --clean
rm *.tar.gz
rm *.zst
9 changes: 1 addition & 8 deletions scripts/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,7 @@ sed --regexp-extended --in-place --expression \
"s/pkgver=(.+)/pkgver=${version}/g" PKGBUILD

updpkgsums PKGBUILD

if [[ -v CI ]]
then
sudo -u build makepkg --printsrcinfo | tee .SRCINFO
else
makepkg --printsrcinfo > .SRCINFO
fi

makepkg --printsrcinfo > .SRCINFO
rm *.tar.gz
git add PKGBUILD .SRCINFO

Expand Down
3 changes: 0 additions & 3 deletions scripts/user.sh

This file was deleted.

0 comments on commit 6c7bc0e

Please sign in to comment.