Compare commits
75 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0f306e414a | |||
| f9ff68181b | |||
| 94f928c5df | |||
| 099605a64c | |||
| d3aea41d02 | |||
| 618a0ba862 | |||
| c9118ad67a | |||
| 2d9dafa60e | |||
| ae967066cb | |||
| cf8509924b | |||
| 1a92d6efa7 | |||
| 8dc2e4d3e8 | |||
| 37bda140be | |||
| f710e16a35 | |||
| 7118f1dd24 | |||
| fda333bd87 | |||
| 80d76aa524 | |||
| 77f37ad6f1 | |||
| c3e3ab0325 | |||
| b257397a15 | |||
| a4f0a491d0 | |||
| eadb0293c0 | |||
| 9400d7c75d | |||
| c121cf29d7 | |||
| 265fe9f569 | |||
| 66d669bebf | |||
| e346bea956 | |||
| 6ade55c2b2 | |||
| 8455f15e27 | |||
| 594be7f44a | |||
| 0a161adbcd | |||
| 94c0a400c6 | |||
| cd2e2d62b6 | |||
| 4da3a1b0cc | |||
| 7926f4fb39 | |||
| 863b0d9617 | |||
| 360be955b0 | |||
| 6443f058c1 | |||
| c05034041f | |||
| d90b1b2689 | |||
| 3747c6e38e | |||
| 10816168b7 | |||
| 87fb26e440 | |||
| 38bb9b95aa | |||
| 65444430c4 | |||
| b3890e00a5 | |||
| 3487dc866b | |||
| 581d4292cc | |||
| 4d1983388b | |||
| fb6ab46b3f | |||
| 796ddff1d3 | |||
| 3d91dafd70 | |||
| bc46e9c8d4 | |||
| 3aa6342a73 | |||
| 8987dba528 | |||
| b8114f2ee3 | |||
| 42c6bfae1e | |||
| fcedc2d02c | |||
| 7f32fc286b | |||
| ec0ee87e6a | |||
| 3c654a34ce | |||
| 65e9437ece | |||
| 0593cc597c | |||
| 88a8c57641 | |||
| f7ff69715a | |||
| 5fa9ff1a99 | |||
| b259baf950 | |||
| 77f0819445 | |||
| 23631f017d | |||
| 9106fe5df2 | |||
| e2ed7401c9 | |||
| 64596b74e7 | |||
| b0781d01e1 | |||
| d318fec45e | |||
| 93e14b2832 |
+134
-5
@@ -4,25 +4,34 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "main"
|
- "main"
|
||||||
|
tags:
|
||||||
|
- 'v*.*.*'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- "main"
|
- "main"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
pretest:
|
||||||
name: Build
|
name: Test (with Dockerfile)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2.3.4
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Update action.yml to build locally
|
||||||
|
run: |
|
||||||
|
sed -i 's/.*image\:.*/ image\: \"Dockerfile\"/' action.yml
|
||||||
|
cat action.yml
|
||||||
|
|
||||||
- name: Get sample PKGBUILD
|
- name: Get sample PKGBUILD
|
||||||
run: wget https://github.com/official-human/nonicons-font/raw/main/PKGBUILD
|
run: wget https://github.com/hapakaien/plenti-bin/raw/f5ffaaee02a2119aa16f6b7a27e87e198e096b47/PKGBUILD
|
||||||
|
|
||||||
- name: Test actions
|
- name: Running test
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
pkgver: '0.4.26'
|
||||||
|
pkgrel: 2
|
||||||
updpkgsums: true
|
updpkgsums: true
|
||||||
srcinfo: true
|
srcinfo: true
|
||||||
|
|
||||||
@@ -31,3 +40,123 @@ jobs:
|
|||||||
ls -la
|
ls -la
|
||||||
git diff PKGBUILD
|
git diff PKGBUILD
|
||||||
git diff .SRCINFO
|
git diff .SRCINFO
|
||||||
|
|
||||||
|
publish:
|
||||||
|
name: Publish OCI image
|
||||||
|
needs: pretest
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Log in to ghcr.io
|
||||||
|
uses: redhat-actions/podman-login@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: OCI metadata
|
||||||
|
id: metadata
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
images: ghcr.io/${{ github.repository }}
|
||||||
|
tags: |
|
||||||
|
type=edge,branch=main
|
||||||
|
type=ref,event=branch
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
type=sha
|
||||||
|
|
||||||
|
- name: Build image
|
||||||
|
id: build
|
||||||
|
uses: redhat-actions/buildah-build@v2
|
||||||
|
with:
|
||||||
|
tags: ${{ steps.metadata.outputs.tags }}
|
||||||
|
labels: ${{ steps.metadata.outputs.labels }}
|
||||||
|
containerfiles: |
|
||||||
|
./Dockerfile
|
||||||
|
extra-args: |
|
||||||
|
--pull
|
||||||
|
|
||||||
|
- name: Push to ghcr.io
|
||||||
|
uses: redhat-actions/push-to-registry@v2
|
||||||
|
with:
|
||||||
|
image: ${{ steps.build.outputs.image }}
|
||||||
|
tags: ${{ steps.build.outputs.tags }}
|
||||||
|
registry: ghcr.io
|
||||||
|
extra-args: |
|
||||||
|
--disable-content-trust
|
||||||
|
|
||||||
|
test:
|
||||||
|
name: Test (with prebuilt OCI Image)
|
||||||
|
needs: publish
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Get sample PKGBUILD
|
||||||
|
run: wget https://github.com/hapakaien/plenti-bin/raw/f5ffaaee02a2119aa16f6b7a27e87e198e096b47/PKGBUILD
|
||||||
|
|
||||||
|
- name: Update action.yml to use edge tagged container image
|
||||||
|
if: github.ref == 'refs/heads/main'
|
||||||
|
run: |
|
||||||
|
REPOSITORY_OWNER=${{ github.repository_owner }}
|
||||||
|
REPOSITORY_OWNER=$(echo $REPOSITORY_OWNER | tr '[:upper:]' '[:lower:]')
|
||||||
|
|
||||||
|
REPOSITORY_NAME=${{ github.event.repository.name }}
|
||||||
|
REPOSITORY_NAME=$(echo $REPOSITORY_NAME | tr '[:upper:]' '[:lower:]')
|
||||||
|
|
||||||
|
sed -i "s/.*image\:.*/ image\: \"docker\:\/\/ghcr.io\/${REPOSITORY_OWNER}\/${REPOSITORY_NAME}\:edge\"/" action.yml
|
||||||
|
cat action.yml
|
||||||
|
|
||||||
|
- name: Running test
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
pkgver: '0.4.26'
|
||||||
|
pkgrel: 2
|
||||||
|
updpkgsums: true
|
||||||
|
srcinfo: true
|
||||||
|
|
||||||
|
- name: Show diff
|
||||||
|
run: |
|
||||||
|
ls -la
|
||||||
|
git diff PKGBUILD
|
||||||
|
git diff .SRCINFO
|
||||||
|
|
||||||
|
release:
|
||||||
|
name: Release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: test
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Get branch/tag names
|
||||||
|
id: branch-name
|
||||||
|
uses: tj-actions/branch-names@v5
|
||||||
|
with:
|
||||||
|
strip_tag_prefix: "v"
|
||||||
|
|
||||||
|
- name: Read changelog
|
||||||
|
id: changelog-reader
|
||||||
|
uses: mindsers/changelog-reader-action@v2
|
||||||
|
with:
|
||||||
|
version: ${{ steps.branch-name.outputs.tag }}
|
||||||
|
path: ./CHANGELOG.md
|
||||||
|
|
||||||
|
- name: Create/update release
|
||||||
|
uses: ncipollo/release-action@v1
|
||||||
|
with:
|
||||||
|
tag: v${{ steps.branch-name.outputs.tag }}
|
||||||
|
name: v${{ steps.branch-name.outputs.tag }}
|
||||||
|
body: ${{ steps.changelog-reader.outputs.changes }}
|
||||||
|
allowUpdates: true
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
name: CD
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- 'main'
|
|
||||||
tags:
|
|
||||||
- 'v*.*.*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
container:
|
|
||||||
name: Publish container image
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: OCI meta
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v3
|
|
||||||
with:
|
|
||||||
images: ghcr.io/${{ github.repository }}
|
|
||||||
tags: |
|
|
||||||
type=edge,branch=main
|
|
||||||
type=ref,event=branch
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
type=semver,pattern={{major}}
|
|
||||||
type=sha
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
|
|
||||||
- name: Login to GHCR
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
+114
@@ -0,0 +1,114 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [2.2.0] - 2022-08-05
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Option to update archlinux-keyring - by @ReenigneArcher
|
||||||
|
- Make repository name lowercase - by @ReenigneArcher
|
||||||
|
|
||||||
|
## [2.1.1] - 2022-05-15
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Wrong conditional using paru
|
||||||
|
|
||||||
|
## [2.1.0] - 2022-05-05
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Option to resolve deps using paru (from AUR) - by @kamack38
|
||||||
|
|
||||||
|
## [2.0.3] - 2022-02-02
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Copied PKGBUILD file has wrong permission
|
||||||
|
|
||||||
|
## [2.0.2] - 2022-02-02
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- CI can not read changelog
|
||||||
|
|
||||||
|
## [2.0.1] - 2022-02-02
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Wrong OCI image tag at action.yml
|
||||||
|
|
||||||
|
## [2.0.0] - 2022-02-02
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Move repo from hapakaien to hapakaien
|
||||||
|
- `builder` user is added to sudoers directly instead of via the wheel group
|
||||||
|
- Replace Docker with Buildah in CI
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- `builder` is not in the sudoers file
|
||||||
|
|
||||||
|
## [1.1.1] - 2021-10-26
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Wrong `.git` folder when using `path` parameter
|
||||||
|
|
||||||
|
## [1.1.0] - 2021-10-02
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Update `pkgver` on PKGBUILD
|
||||||
|
- Update `pkgrel` on PKGBUILD
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Missing `set -e` on bash
|
||||||
|
|
||||||
|
## [1.0.3] - 2021-05-30
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- $GITHUB_WORKSPACE permission in step after using this action
|
||||||
|
|
||||||
|
## [1.0.2] - 2021-05-26
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Docker runner syntax
|
||||||
|
- Path sntax
|
||||||
|
|
||||||
|
## [1.0.1] - 2021-05-19
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Missing documentation
|
||||||
|
|
||||||
|
## [1.0.0] - 2021-05-19
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Initial release
|
||||||
|
|
||||||
|
[Unreleased]: https://github.com/hapakaien/archlinux-package-action/compare/v2.2.0...HEAD
|
||||||
|
[2.2.0]: https://github.com/hapakaien/archlinux-package-action/compare/v2.1.1...v2.2.0
|
||||||
|
[2.1.1]: https://github.com/hapakaien/archlinux-package-action/compare/v2.1.0...v2.1.1
|
||||||
|
[2.1.0]: https://github.com/hapakaien/archlinux-package-action/compare/v2.0.3...v2.1.0
|
||||||
|
[2.0.3]: https://github.com/hapakaien/archlinux-package-action/compare/v2.0.2...v2.0.3
|
||||||
|
[2.0.2]: https://github.com/hapakaien/archlinux-package-action/compare/v2.0.1...v2.0.2
|
||||||
|
[2.0.1]: https://github.com/hapakaien/archlinux-package-action/compare/v2.0.0...v2.0.1
|
||||||
|
[2.0.0]: https://github.com/hapakaien/archlinux-package-action/compare/v1.1.1...v2.0.0
|
||||||
|
[1.1.1]: https://github.com/hapakaien/archlinux-package-action/compare/v1.1.0...v1.1.1
|
||||||
|
[1.1.0]: https://github.com/hapakaien/archlinux-package-action/compare/v1.0.3...v1.1.0
|
||||||
|
[1.0.3]: https://github.com/hapakaien/archlinux-package-action/compare/v1.0.2...v1.0.3
|
||||||
|
[1.0.2]: https://github.com/hapakaien/archlinux-package-action/compare/v1.0.1...v1.0.2
|
||||||
|
[1.0.1]: https://github.com/hapakaien/archlinux-package-action/compare/v1.0.0...v1.0.1
|
||||||
|
[1.0.0]: https://github.com/hapakaien/archlinux-package-action/releases/tag/v1.0.0
|
||||||
+7
-2
@@ -6,8 +6,13 @@ RUN pacman -Syu --needed --noconfirm pacman-contrib namcap git
|
|||||||
|
|
||||||
# Setup user
|
# Setup user
|
||||||
RUN useradd -m builder && \
|
RUN useradd -m builder && \
|
||||||
usermod -aG wheel builder && \
|
echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
||||||
echo 'wheel ALL=(ALL:ALL) ALL' >> /etc/sudoers
|
WORKDIR /home/builder
|
||||||
|
USER builder
|
||||||
|
|
||||||
|
# Install paru
|
||||||
|
RUN git clone https://aur.archlinux.org/paru-bin.git
|
||||||
|
RUN cd paru-bin && makepkg -si --noconfirm
|
||||||
|
|
||||||
# Copy files
|
# Copy files
|
||||||
COPY LICENSE README.md /
|
COPY LICENSE README.md /
|
||||||
|
|||||||
@@ -1,33 +1,41 @@
|
|||||||
# Arch Linux's package tools action
|
# Arch Linux's package tools action
|
||||||
|
|
||||||
[](https://github.com/datakrama/archlinux-package-action/actions) [](https://github.com/datakrama/archlinux-package-action/releases) [](./LICENSE)
|
[](https://github.com/hapakaien/archlinux-package-action/actions) [](https://github.com/hapakaien/archlinux-package-action/releases) [](./LICENSE)
|
||||||
|
|
||||||
This action allows running tools needed for creating Arch Linux (and AUR) package.
|
This action allows running tools needed for creating Arch Linux (and AUR) package.
|
||||||
Here's what this action can do:
|
Here's what this action can do:
|
||||||
|
|
||||||
- Update checksums on PKGBUILD file
|
- Update `pkgver`, `pkgrel`, or checksums on PKGBUILD file
|
||||||
- Generate [.SRCINFO](https://wiki.archlinux.org/title/.SRCINFO) based on your PKGBUILD
|
|
||||||
- Validate PKGBUILD with [namcap](https://wiki.archlinux.org/title/namcap)
|
- Validate PKGBUILD with [namcap](https://wiki.archlinux.org/title/namcap)
|
||||||
|
- Generate [.SRCINFO](https://wiki.archlinux.org/title/.SRCINFO) based on your PKGBUILD
|
||||||
- Run [makepkg](https://wiki.archlinux.org/title/Makepkg) with custom flags (rather than default)
|
- Run [makepkg](https://wiki.archlinux.org/title/Makepkg) with custom flags (rather than default)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Requirement
|
### Requirement
|
||||||
|
|
||||||
- [PKGBUILD](https://wiki.archlinux.org/title/PKGBUILD) file inside your repository.
|
- [PKGBUILD](https://wiki.archlinux.org/title/PKGBUILD) file inside your repository.
|
||||||
|
- Use [actions/checkout](https://github.com/actions/checkout) in previous step. This is important, unless you want your [$GITHUB_WORKSPACE](https://docs.github.com/en/actions/reference/environment-variables#default-environment-variables) folder to be empty.
|
||||||
|
|
||||||
### Customizing
|
### Customizing
|
||||||
|
|
||||||
Following inputs can be used as `step.with` keys
|
Following inputs can be used as `step.with` keys
|
||||||
|
|
||||||
| Name | Type | Default | Required | Description |
|
| Name | Type | Default | Required | Description |
|
||||||
|-------------------|-----------|-------------------------------|-----------|---------------------------------------|
|
| -------------------------- | ------- | ------------------ | -------- | -------------------------------------------------------------------------------- |
|
||||||
| `path` | String | $GITHUB_WORKSPACE | `false` | Path where PKGBUILD is located |
|
| `path` | String | | `false` | Path where PKGBUILD is located. This path always located under $GITHUB_WORKSPACE |
|
||||||
|
| `pkgver` | String | | `false` | Update `pkgver` on your PKGBUILD |
|
||||||
|
| `pkgrel` | Integer | | `false` | Update `pkgrel` on your PKGBUILD |
|
||||||
| `updpkgsums` | Boolean | `false` | `false` | Update checksums on your PKGBUILD |
|
| `updpkgsums` | Boolean | `false` | `false` | Update checksums on your PKGBUILD |
|
||||||
| `srcinfo` | Boolean | `false` | `false` | Generate new .SRCINFO |
|
| `srcinfo` | Boolean | `false` | `false` | Generate new .SRCINFO |
|
||||||
| `namcap` | Boolean | `true` | `false` | Validate PKGBUILD |
|
| `namcap` | Boolean | `true` | `false` | Validate PKGBUILD |
|
||||||
| `flags` | String | `-cfs --noconfirm` | `false` | Flags after `makepkg` command. Leave this empty will disable this command. |
|
| `flags` | String | `-cfs --noconfirm` | `false` | Flags after `makepkg` command. Leave this empty will disable this command. |
|
||||||
|
| `aur` | Boolean | `false` | `false` | Resolve dependencies using paru |
|
||||||
|
| `update_archlinux_keyring` | Boolean | `true` | `false` | Update the archlinux keyring |
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
#### Basic
|
|
||||||
|
#### 1. Basic
|
||||||
|
|
||||||
This action will run `makepkg -cfs --noconfirm` command, then validate PKGBUILD with namcap.
|
This action will run `makepkg -cfs --noconfirm` command, then validate PKGBUILD with namcap.
|
||||||
|
|
||||||
@@ -42,9 +50,85 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Validate package
|
- name: Validate package
|
||||||
uses: datakrama/archlinux-package-action@v1
|
uses: hapakaien/archlinux-package-action@v2
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 2. Only generate .SRCINFO
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Validate package
|
||||||
|
uses: hapakaien/archlinux-package-action@v2
|
||||||
|
with:
|
||||||
|
flags: ''
|
||||||
|
namcap: false
|
||||||
|
srcinfo: true
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 3. Only update checksums on PKGBUILD
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Validate package
|
||||||
|
uses: hapakaien/archlinux-package-action@v2
|
||||||
|
with:
|
||||||
|
flags: ''
|
||||||
|
namcap: false
|
||||||
|
updpkgsums: true
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 4. Custom path & custom flags
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Validate package
|
||||||
|
uses: hapakaien/archlinux-package-action@v2
|
||||||
|
with:
|
||||||
|
path: package
|
||||||
|
flags: '-si --noconfirm'
|
||||||
|
namcap: false
|
||||||
```
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
The scripts and documentation in this project are released under the [MIT License](./LICENSE)
|
|
||||||
|
The scripts and documentation in this project are released under the [MIT License](LICENSE)
|
||||||
|
|||||||
+35
-15
@@ -1,39 +1,59 @@
|
|||||||
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
|
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
|
||||||
name: "Arch Linux's package action"
|
name: "Arch Linux's package action"
|
||||||
description: "GitHub Action to run Arch Linux's package tools"
|
description: "GitHub Action to run Arch Linux's package tools"
|
||||||
author: "datakrama"
|
author: 'hapakaien'
|
||||||
branding:
|
branding:
|
||||||
icon: "package"
|
icon: 'package'
|
||||||
color: "green"
|
color: 'blue'
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
path:
|
path:
|
||||||
description: "Location for this action to run"
|
description: 'Location for this action to run'
|
||||||
default: ""
|
default: ''
|
||||||
|
required: false
|
||||||
|
pkgver:
|
||||||
|
description: 'Update pkgver on PKGBUILD'
|
||||||
|
default: ''
|
||||||
|
required: false
|
||||||
|
pkgrel:
|
||||||
|
description: 'Update pkgrel on PKGBUILD'
|
||||||
|
default: ''
|
||||||
required: false
|
required: false
|
||||||
updpkgsums:
|
updpkgsums:
|
||||||
description: "Update checksums on PKGBUILD"
|
description: 'Update checksums on PKGBUILD'
|
||||||
default: "false"
|
default: 'false'
|
||||||
required: false
|
required: false
|
||||||
srcinfo:
|
srcinfo:
|
||||||
description: "Generate new .SRCINFO"
|
description: 'Generate new .SRCINFO'
|
||||||
default: "false"
|
default: 'false'
|
||||||
required: false
|
required: false
|
||||||
flags:
|
flags:
|
||||||
description: "Extra flags for makepkg"
|
description: 'Extra flags for makepkg'
|
||||||
default: "-cfs --noconfirm"
|
default: '-cfs --noconfirm'
|
||||||
required: false
|
required: false
|
||||||
namcap:
|
namcap:
|
||||||
description: "Validate package with namcap"
|
description: 'Validate package with namcap'
|
||||||
default: "true"
|
default: 'true'
|
||||||
|
required: false
|
||||||
|
aur:
|
||||||
|
description: 'Resolve dependencies using paru'
|
||||||
|
default: 'false'
|
||||||
|
required: false
|
||||||
|
update_archlinux_keyring:
|
||||||
|
description: 'Update archlinux-keyring'
|
||||||
|
default: 'true'
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "docker"
|
using: 'docker'
|
||||||
image: "Dockerfile"
|
image: 'docker://ghcr.io/hapakaien/archlinux-package-action:2'
|
||||||
args:
|
args:
|
||||||
- ${{ inputs.path }}
|
- ${{ inputs.path }}
|
||||||
|
- ${{ inputs.pkgver }}
|
||||||
|
- ${{ inputs.pkgrel }}
|
||||||
- ${{ inputs.updpkgsums }}
|
- ${{ inputs.updpkgsums }}
|
||||||
- ${{ inputs.srcinfo }}
|
- ${{ inputs.srcinfo }}
|
||||||
- ${{ inputs.flags }}
|
- ${{ inputs.flags }}
|
||||||
- ${{ inputs.namcap }}
|
- ${{ inputs.namcap }}
|
||||||
|
- ${{ inputs.aur }}
|
||||||
|
- ${{ inputs.update_archlinux_keyring }}
|
||||||
|
|||||||
+63
-18
@@ -1,37 +1,82 @@
|
|||||||
#!/bin/sh -l
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
# Set path
|
# Set path
|
||||||
WORKPATH=$GITHUB_WORKSPACE
|
WORKPATH=$GITHUB_WORKSPACE/$INPUT_PATH
|
||||||
if [[ -n "$INPUT_PATH" ]]; then
|
HOME=/home/builder
|
||||||
WORKPATH=$INPUT_PATH
|
echo "::group::Copying files from $WORKPATH to $HOME/gh-action"
|
||||||
|
# Set path permision
|
||||||
|
cd $HOME
|
||||||
|
mkdir gh-action
|
||||||
|
cd gh-action
|
||||||
|
cp -rfv "$GITHUB_WORKSPACE"/.git ./
|
||||||
|
cp -fv "$WORKPATH"/PKGBUILD ./
|
||||||
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
# Update archlinux-keyring
|
||||||
|
if [[ $INPUT_ARCHLINUX_KEYRING == true ]]; then
|
||||||
|
echo "::group::Updating archlinux-keyring"
|
||||||
|
pacman -S archlinux-keyring
|
||||||
|
echo "::endgroup::"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set path permision
|
# Update pkgver
|
||||||
sudo chown -R builder $WORKPATH
|
if [[ -n $INPUT_PKGVER ]]; then
|
||||||
cd $WORKPATH
|
echo "::group::Updating pkgver on PKGBUILD"
|
||||||
|
sed -i "s:^pkgver=.*$:pkgver=$INPUT_PKGVER:g" PKGBUILD
|
||||||
|
git diff PKGBUILD
|
||||||
|
echo "::endgroup::"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update pkgver
|
||||||
|
if [[ -n $INPUT_PKGREL ]]; then
|
||||||
|
echo "::group::Updating pkgrel on PKGBUILD"
|
||||||
|
sed -i "s:^pkgrel=.*$:pkgrel=$INPUT_PKGREL:g" PKGBUILD
|
||||||
|
git diff PKGBUILD
|
||||||
|
echo "::endgroup::"
|
||||||
|
fi
|
||||||
|
|
||||||
# Update checksums
|
# Update checksums
|
||||||
if [[ $INPUT_UPDPKGSUMS == true ]]; then
|
if [[ $INPUT_UPDPKGSUMS == true ]]; then
|
||||||
echo "Update checksums on PKGBUILD"
|
echo "::group::Updating checksums on PKGBUILD"
|
||||||
sudo -u builder updpkgsums
|
updpkgsums
|
||||||
git diff PKGBUILD
|
git diff PKGBUILD
|
||||||
|
echo "::endgroup::"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Generate .SRCINFO
|
# Generate .SRCINFO
|
||||||
if [[ $INPUT_SRCINFO == true ]]; then
|
if [[ $INPUT_SRCINFO == true ]]; then
|
||||||
echo "Generate new .SRCINFO based on PKGBUILD"
|
echo "::group::Generating new .SRCINFO based on PKGBUILD"
|
||||||
sudo -u builder makepkg --printsrcinfo > .SRCINFO
|
makepkg --printsrcinfo >.SRCINFO
|
||||||
git diff .SRCINFO
|
git diff .SRCINFO
|
||||||
fi
|
echo "::endgroup::"
|
||||||
|
|
||||||
# Run makepkg
|
|
||||||
if [[ -n "$INPUT_FLAGS" ]]; then
|
|
||||||
echo "Run makepkg with flags"
|
|
||||||
sudo -u builder makepkg $INPUT_FLAGS
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Validate with namcap
|
# Validate with namcap
|
||||||
if [[ $INPUT_NAMCAP == true ]]; then
|
if [[ $INPUT_NAMCAP == true ]]; then
|
||||||
echo "Validate PKGBUILD with namcap"
|
echo "::group::Validating PKGBUILD with namcap"
|
||||||
namcap -i PKGBUILD
|
namcap -i PKGBUILD
|
||||||
|
echo "::endgroup::"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Install depends using paru from aur
|
||||||
|
if [[ $INPUT_AUR == true ]]; then
|
||||||
|
echo "::group::Installing depends using paru"
|
||||||
|
source PKGBUILD
|
||||||
|
paru -Syu --removemake --needed --noconfirm "${depends[@]}" "${makedepends[@]}"
|
||||||
|
echo "::endgroup::"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run makepkg
|
||||||
|
if [[ -n $INPUT_FLAGS ]]; then
|
||||||
|
echo "::group::Running makepkg with flags"
|
||||||
|
makepkg $INPUT_FLAGS
|
||||||
|
echo "::endgroup::"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "::group::Copying files from $HOME/gh-action to $WORKPATH"
|
||||||
|
sudo cp -fv PKGBUILD "$WORKPATH"/PKGBUILD
|
||||||
|
if [[ -e .SRCINFO ]]; then
|
||||||
|
sudo cp -fv .SRCINFO "$WORKPATH"/.SRCINFO
|
||||||
|
fi
|
||||||
|
echo "::endgroup::"
|
||||||
|
|||||||
Reference in New Issue
Block a user