mirror of
https://github.com/Jguer/yay
synced 2024-07-05 01:41:43 +00:00
ci(builder): update ci builder
This commit is contained in:
parent
8d9fed2ad0
commit
f24e21105e
46
.github/workflows/multiarch-build.yml
vendored
46
.github/workflows/multiarch-build.yml
vendored
|
@ -8,30 +8,49 @@ jobs:
|
|||
build-releases:
|
||||
strategy:
|
||||
matrix:
|
||||
arch: ["x86_64", "armv7h", "aarch64"]
|
||||
arch:
|
||||
[
|
||||
"linux/amd64 x86_64",
|
||||
"linux/arm/v6 armv6h",
|
||||
"linux/arm/v7 armv7h",
|
||||
"linux/arm64 aarch64",
|
||||
]
|
||||
name: Build ${{ matrix.arch }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
with:
|
||||
platforms: all
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
with:
|
||||
version: latest
|
||||
- name: Read info
|
||||
id: tags
|
||||
shell: bash
|
||||
run: |
|
||||
echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
|
||||
echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//}
|
||||
- name: Install dependencies
|
||||
run: sudo apt update -y && sudo apt install -y qemu qemu-user-static
|
||||
- name: Setup qemu-user-static
|
||||
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
arch="${{ matrix.arch }}"
|
||||
echo ::set-output name=PLATFORM::${arch%% *}
|
||||
echo ::set-output name=ARCH::${arch##* }
|
||||
- name: Build ${{ matrix.arch }} release
|
||||
run: |
|
||||
mkdir artifacts
|
||||
make docker-release-${{ matrix.arch }} ARCH=${{ matrix.arch }} VERSION=${{ steps.tags.outputs.version }} PREFIX="/usr"
|
||||
docker buildx build --platform ${{ steps.tags.outputs.platform }} \
|
||||
--build-arg VERSION=${{ steps.tags.outputs.version }} \
|
||||
--build-arg ARCH=${{ steps.tags.outputs.arch }} \
|
||||
--build-arg PREFIX="/usr" \
|
||||
-t yay:${{ steps.tags.outputs.arch }} . --load
|
||||
make docker-release ARCH=${{ steps.tags.outputs.arch }} VERSION=${{ steps.tags.outputs.version }} PREFIX="/usr"
|
||||
mv *.tar.gz artifacts
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: yay_${{ matrix.arch }}
|
||||
name: yay_${{ steps.tags.outputs.arch }}
|
||||
path: artifacts
|
||||
create_release:
|
||||
name: Create release from this build
|
||||
|
@ -50,6 +69,9 @@ jobs:
|
|||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: yay_armv7h
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: yay_armv6h
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: yay_aarch64
|
||||
|
@ -83,6 +105,16 @@ jobs:
|
|||
asset_path: ./yay_${{ steps.tags.outputs.version }}_armv7h.tar.gz
|
||||
asset_name: yay_${{ steps.tags.outputs.version }}_armv7h.tar.gz
|
||||
asset_content_type: application/tar+gzip
|
||||
- name: Upload armv6h asset
|
||||
id: upload-release-asset-armv6h
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./yay_${{ steps.tags.outputs.version }}_armv6h.tar.gz
|
||||
asset_name: yay_${{ steps.tags.outputs.version }}_armv6h.tar.gz
|
||||
asset_content_type: application/tar+gzip
|
||||
- name: Upload aarch64 asset
|
||||
id: upload-release-asset-aarch64
|
||||
uses: actions/upload-release-asset@v1
|
||||
|
|
18
Dockerfile
18
Dockerfile
|
@ -1,16 +1,12 @@
|
|||
ARG BUILD_TAG=devel
|
||||
FROM samip537/archlinux:${BUILD_TAG}
|
||||
FROM jguer/yay-builder:latest
|
||||
LABEL maintainer="Jguer,joaogg3 at google mail"
|
||||
|
||||
ARG VERSION
|
||||
ARG PREFIX
|
||||
ARG ARCH
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN pacman -Syu --overwrite=* --needed --noconfirm \
|
||||
go git
|
||||
|
||||
COPY go.mod .
|
||||
COPY go.sum .
|
||||
|
||||
RUN go mod download
|
||||
|
||||
ENV ARCH=x86_64
|
||||
COPY . .
|
||||
|
||||
RUN make release VERSION=${VERSION} PREFIX=${PREFIX} ARCH=${ARCH}
|
||||
|
|
20
Makefile
20
Makefile
|
@ -65,24 +65,8 @@ docker-release-all:
|
|||
make docker-release-x86_64 ARCH=x86_64
|
||||
make docker-release-aarch64 ARCH=aarch64
|
||||
|
||||
.PHONY: docker-release-armv7h
|
||||
docker-release-armv7h:
|
||||
docker build --build-arg="BUILD_TAG=arm32v7-devel" -t yay-$(ARCH):${VERSION} .
|
||||
docker run -e="ARCH=$(ARCH)" --name yay-$(ARCH) yay-$(ARCH):${VERSION} make release VERSION=${VERSION} PREFIX=${PREFIX}
|
||||
docker cp yay-$(ARCH):/app/${PACKAGE} $(PACKAGE)
|
||||
docker container rm yay-$(ARCH)
|
||||
|
||||
.PHONY: docker-release-aarch64
|
||||
docker-release-aarch64:
|
||||
docker build --build-arg="BUILD_TAG=arm64v8-devel" -t yay-$(ARCH):${VERSION} .
|
||||
docker run -e="ARCH=$(ARCH)" --name yay-$(ARCH) yay-$(ARCH):${VERSION} make release VERSION=${VERSION} PREFIX=${PREFIX}
|
||||
docker cp yay-$(ARCH):/app/${PACKAGE} $(PACKAGE)
|
||||
docker container rm yay-$(ARCH)
|
||||
|
||||
.PHONY: docker-release-x86_64
|
||||
docker-release-x86_64:
|
||||
docker build --build-arg="BUILD_TAG=devel" -t yay-$(ARCH):${VERSION} .
|
||||
docker run -e="ARCH=$(ARCH)" --name yay-$(ARCH) yay-$(ARCH):${VERSION} make release VERSION=${VERSION} PREFIX=${PREFIX}
|
||||
docker-release:
|
||||
docker create --name yay-$(ARCH) yay:${ARCH}
|
||||
docker cp yay-$(ARCH):/app/${PACKAGE} $(PACKAGE)
|
||||
docker container rm yay-$(ARCH)
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ LABEL maintainer="Jguer,joaogg3 at google mail"
|
|||
ENV GO111MODULE=on
|
||||
WORKDIR /app
|
||||
|
||||
RUN pacman -Syu --overwrite=* --needed --noconfirm go fakeroot binutils gcc make git &&\
|
||||
RUN pacman -Syu --overwrite=* --needed --noconfirm go fakeroot binutils gcc make git gettext &&\
|
||||
rm -rfv /var/cache/pacman/* /var/lib/pacman/sync/*
|
||||
|
||||
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.31.0
|
||||
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.32.2
|
||||
|
||||
COPY go.mod .
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user