Refactoring logic and intro Github Actions (#26)

* Refactoring logic

- Modify all dockerfile files, unified replacement logic
- Fix `perl` required error.
- Add ignore file
- Fix CentOS 5 support, by change mirror from
  `http://archive.kernel.org` to `http://linuxsoft.cern.ch`

* Update README.md

- Add a short usage for docker

* Create Github Actions

- Add `build-images.yml` to auto build docker images. Support: CentOS 7/6/5, CentOS Stream 8/9, Amazon Linux 1/2/2023.

- Add `create-amd64-release.yml` to auto create amd64 release files.

- Add `create-arm64-release.yml` to auto create arm64 release files.

- Reformat release comment

Features:

- Using batch build and batch compile

- Using latest action version
This commit is contained in:
ChowRex
2024-07-23 14:08:11 +08:00
committed by GitHub
parent 22c93f527d
commit 7c83502a8c
10 changed files with 909 additions and 68 deletions

341
.github/workflows/build-images.yml vendored Normal file
View File

@@ -0,0 +1,341 @@
# This is a basic workflow to help you get started with Actions
name: Build Docker Images
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build_and_push_al2023:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
CHINA_MIRROR: "0"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build and push Amazon Linux 2023
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile.amazonlinux
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:amazonlinux2023,${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:al2023
build-args: |
VERSION_NUM=2023
- name: Log out from Docker Hub
run: docker logout
build_and_push_al2:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
CHINA_MIRROR: "0"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build and push Amazon Linux 2
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile.amazonlinux
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:amazonlinux2,${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:al2
build-args: |
VERSION_NUM=2
- name: Log out from Docker Hub
run: docker logout
build_and_push_al1:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
CHINA_MIRROR: "0"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build and push Amazon Linux 1
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile.amazonlinux
platforms: linux/amd64
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:amazonlinux1,${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:al1
build-args: |
VERSION_NUM=1
- name: Log out from Docker Hub
run: docker logout
build_and_push_el9:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
CHINA_MIRROR: "0"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build and push CentOS Stream 9
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile.centos-stream
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:centos-stream9,${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:el9
build-args: |
VERSION_NUM=9
- name: Log out from Docker Hub
run: docker logout
build_and_push_el8:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
CHINA_MIRROR: "0"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build and push CentOS Stream 8
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile.centos-stream
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:centos-stream8,${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:el8
build-args: |
VERSION_NUM=8
- name: Log out from Docker Hub
run: docker logout
build_and_push_el7:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
CHINA_MIRROR: "0"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build and push CentOS 7
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile.centos
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:centos7,${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:el7
build-args: |
VERSION_NUM=7
- name: Log out from Docker Hub
run: docker logout
build_and_push_el6:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
CHINA_MIRROR: "0"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build and push CentOS 6
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile.centos
platforms: linux/amd64
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:centos6,${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:el6
build-args: |
VERSION_NUM=6
- name: Log out from Docker Hub
run: docker logout
build_and_push_el5:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Set this to prevents a workflow run from failing when this job fail.
continue-on-error: true
env:
CHINA_MIRROR: "0"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build and push CentOS 5
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile.centos
platforms: linux/amd64
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:centos5,${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:el5
build-args: |
VERSION_NUM=5
- name: Log out from Docker Hub
run: docker logout

View File

@@ -0,0 +1,249 @@
# This is a basic workflow to help you get started with Actions
name: Create amd64 release
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
tags: [ "v*" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build_al2023:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4
- name: "Compile Amazon Linux 2023 (amd64)"
run: |
docker run --rm -v ${{ github.workspace }}/output:/data/amzn2023/RPMS/x86_64 ${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:amazonlinux2023
- uses: actions/upload-artifact@v4
with:
name: al2023-amd64
path: ${{ github.workspace }}/output
build_al2:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4
- name: "Compile Amazon Linux 2 (amd64)"
run: |
docker run --rm -v ${{ github.workspace }}/output:/data/amzn2/RPMS/x86_64 ${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:amazonlinux2
- uses: actions/upload-artifact@v4
with:
name: al2-amd64
path: ${{ github.workspace }}/output
build_al1:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4
- name: "Compile Amazon Linux 1 (amd64)"
run: |
docker run --rm -v ${{ github.workspace }}/output:/data/amzn1/RPMS/x86_64 ${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:amazonlinux1
- uses: actions/upload-artifact@v4
with:
name: al1-amd64
path: ${{ github.workspace }}/output
build_el9:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4
- name: "Compile CentOS Stream 9 (amd64)"
run: |
docker run --rm -v ${{ github.workspace }}/output:/data/el7/RPMS/x86_64 ${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:centos-stream9
- uses: actions/upload-artifact@v4
with:
name: el9-amd64
path: ${{ github.workspace }}/output
build_el8:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4
- name: "Compile CentOS Stream 8 (amd64)"
run: |
docker run --rm -v ${{ github.workspace }}/output:/data/el7/RPMS/x86_64 ${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:centos-stream8
- uses: actions/upload-artifact@v4
with:
name: el8-amd64
path: ${{ github.workspace }}/output
build_el7:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4
- name: "Compile CentOS 7 (amd64)"
run: |
docker run --rm -v ${{ github.workspace }}/output:/data/el7/RPMS/x86_64 ${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:centos7
- uses: actions/upload-artifact@v4
with:
name: el7-amd64
path: ${{ github.workspace }}/output
build_el6:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4
- name: "Compile CentOS 6 (amd64)"
run: |
docker run --rm -v ${{ github.workspace }}/output:/data/el6/RPMS/x86_64 ${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:centos6
- uses: actions/upload-artifact@v4
with:
name: el6-amd64
path: ${{ github.workspace }}/output
build_el5:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4
- name: "Download packages for CentOS 5"
run: |
OPENSSHMIR=https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable
OPENSSLMIR=https://www.openssl.org/source/
ASKPASSMIR=https://src.fedoraproject.org/repo/pkgs/openssh/x11-ssh-askpass-1.2.4.1.tar.gz/8f2e41f3f7eaa8543a2440454637f3c3
PERLMIR=https://www.cpan.org/src/5.0
source ${{ github.workspace }}/version.env
pushd ${{ github.workspace }}/downloads
curl -O -L -k $OPENSSLMIR/$OPENSSLSRC
curl -O -L -k $OPENSSHMIR/$OPENSSHSRC
curl -O -L -k $ASKPASSMIR/$ASKPASSSRC
curl -O -L -k $PERLMIR/$PERLSRC
popd
- name: "Compile CentOS 5 (amd64)"
run: |
docker run --rm -v ${{ github.workspace }}/output:/data/el5/RPMS/x86_64 -v ${{ github.workspace }}/downloads:/data/downloads ${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:centos5
- uses: actions/upload-artifact@v4
with:
name: el5-amd64
path: ${{ github.workspace }}/output
create_release:
needs:
- build_al2023
- build_al2
- build_al1
- build_el9
- build_el8
- build_el7
- build_el6
- build_el5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: al2023-amd64
path: ./output
- uses: actions/download-artifact@v4
with:
name: al2-amd64
path: ./output
- uses: actions/download-artifact@v4
with:
name: al1-amd64
path: ./output
- uses: actions/download-artifact@v4
with:
name: el9-amd64
path: ./output
- uses: actions/download-artifact@v4
with:
name: el8-amd64
path: ./output
- uses: actions/download-artifact@v4
with:
name: el7-amd64
path: ./output
- uses: actions/download-artifact@v4
with:
name: el6-amd64
path: ./output
- uses: actions/download-artifact@v4
with:
name: el5-amd64
path: ./output
- name: Get tag message
run: |
echo -e "> Automated release created by GitHub Actions.\n" > ${{ github.workspace }}/RELEASE.md
GITHUB_REF=${{ github.ref }}
TAG_NAME="${GITHUB_REF#refs/tags/}"
git tag -l --format='%(contents)' "${TAG_NAME}" | tee -a ${{ github.workspace }}/RELEASE.md
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
artifacts: "${{ github.workspace }}/output/*"
bodyFile: ${{ github.workspace }}/RELEASE.md
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true

View File

@@ -0,0 +1,196 @@
# This is a basic workflow to help you get started with Actions
name: Create arm64 release
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
tags: [ "v*" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build_al2023:
# The type of runner that the job will run on
# See: https://docs.github.com/zh/actions/using-jobs/choosing-the-runner-for-a-job
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: "Compile Amazon Linux 2023 (arm64)"
run: |
docker run --rm --platform linux/arm64 -v ${{ github.workspace }}/output:/data/amzn2023/RPMS/aarch64 ${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:amazonlinux2023
- uses: actions/upload-artifact@v4
with:
name: al2023-arm64
path: ${{ github.workspace }}/output
build_al2:
# The type of runner that the job will run on
# See: https://docs.github.com/zh/actions/using-jobs/choosing-the-runner-for-a-job
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: "Compile Amazon Linux 2 (arm64)"
run: |
docker run --rm --platform linux/arm64 -v ${{ github.workspace }}/output:/data/amzn2/RPMS/aarch64 ${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:amazonlinux2
- uses: actions/upload-artifact@v4
with:
name: al2-arm64
path: ${{ github.workspace }}/output
build_el9:
# The type of runner that the job will run on
# See: https://docs.github.com/zh/actions/using-jobs/choosing-the-runner-for-a-job
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: "Compile CentOS Stream 9 (arm64)"
run: |
docker run --rm --platform linux/arm64 -v ${{ github.workspace }}/output:/data/el7/RPMS/aarch64 ${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:centos-stream9
- uses: actions/upload-artifact@v4
with:
name: el9-arm64
path: ${{ github.workspace }}/output
build_el8:
# The type of runner that the job will run on
# See: https://docs.github.com/zh/actions/using-jobs/choosing-the-runner-for-a-job
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: "Compile CentOS Stream 8 (arm64)"
run: |
docker run --rm --platform linux/arm64 -v ${{ github.workspace }}/output:/data/el7/RPMS/aarch64 ${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:centos-stream8
- uses: actions/upload-artifact@v4
with:
name: el8-arm64
path: ${{ github.workspace }}/output
build_el7:
# The type of runner that the job will run on
# See: https://docs.github.com/zh/actions/using-jobs/choosing-the-runner-for-a-job
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: "Compile CentOS 7 (arm64)"
run: |
docker run --rm --platform linux/arm64 -v ${{ github.workspace }}/output:/data/el7/RPMS/aarch64 ${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:centos7
- uses: actions/upload-artifact@v4
with:
name: el7-arm64
path: ${{ github.workspace }}/output
create_release:
needs:
- build_al2023
- build_al2
- build_el9
- build_el8
- build_el7
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: al2023-arm64
path: ./output
- uses: actions/download-artifact@v4
with:
name: al2-arm64
path: ./output
- uses: actions/download-artifact@v4
with:
name: el9-arm64
path: ./output
- uses: actions/download-artifact@v4
with:
name: el8-arm64
path: ./output
- uses: actions/download-artifact@v4
with:
name: el7-arm64
path: ./output
- name: Get tag message
run: |
echo -e "> Automated release created by GitHub Actions.\n" > ${{ github.workspace }}/RELEASE.md
GITHUB_REF=${{ github.ref }}
TAG_NAME="${GITHUB_REF#refs/tags/}"
git tag -l --format='%(contents)' "${TAG_NAME}" | tee -a ${{ github.workspace }}/RELEASE.md
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
artifacts: "${{ github.workspace }}/output/*"
bodyFile: ${{ github.workspace }}/RELEASE.md
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true

1
.gitignore vendored
View File

@@ -5,3 +5,4 @@ BUILD/
*/SRPMS/*
*/BUILD/*
*/BUILDROOT/*
downloads/*.tar.gz

View File

@@ -97,10 +97,39 @@ If still not satisfied, you may try the final wepon: FORCED INSTALL.
rpm -ivh --force --nodeps --replacepkgs --replacefiles openssh-*.rpm
```
## Use Docker
See file `docker.README.md`
### TL;DR
```bash
# Define output directory
OUTPUT="/tmp/openssh-rpms"
# Specify build os and versions
declare -A MAPPING
MAPPING["amazonlinux2023"]="amzn2023"
MAPPING["amazonlinux2"]="amzn2"
MAPPING["amazonlinux1"]="amzn1"
MAPPING["centos-stream9"]="el7"
MAPPING["centos-stream8"]="el7"
MAPPING["centos7"]="el7"
MAPPING["centos6"]="el6"
# CentOS 5 is NOT valid.
# MAPPING["centos5"]="el5"
for VERSION in "${!MAPPING[@]}";
do
DIST=${MAPPING[$VERSION]}
echo "Create for OS: ${VERSION}"
mkdir -p $OUTPUT/$VERSION
# Run the builder container
docker run -it --rm \
-v $OUTPUT/$VERSION:/data/$DIST/RPMS \
chowrex/openssh-rpms:$VERSION
done
```
For more details, see file `docker.README.md`
## Security Notes

View File

@@ -9,9 +9,8 @@ WORKDIR /data
# Copy all files
COPY . /data
RUN if [ "$CHINA_MIRROR" != "0" ]; then \
bash ./docker/modify_yum_source.sh; \
fi && \
RUN export CHINA_MIRROR="$CHINA_MIRROR" && \
bash ./docker/modify_yum_source.sh && \
if [ "$VERSION_NUM" = "2023" ]; then \
yum makecache timer && yum install -y libnsl; \
elif [ "$VERSION_NUM" = "2" ]; then \

View File

@@ -9,22 +9,8 @@ WORKDIR /data
# Copy all files
COPY . /data
RUN if [ "$VERSION_NUM" = "8" ]; then \
MIRROR_URL="https://vault.centos.org" && \
sed -e "s|^mirrorlist=|#mirrorlist=|g" \
-e "s|^#baseurl=http://mirror.centos.org/centos/\$releasever|baseurl=${MIRROR_URL}/8.4.2105|g" \
-e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=${MIRROR_URL}/8.4.2105|g" \
-i /etc/yum.repos.d/CentOS-*.repo; \
elif [ "$VERSION_NUM" = "5" ]; then \
MIRROR_URL="http://archive.kernel.org" && \
sed -e "s|^mirrorlist=|#mirrorlist=|g" \
-e "s|^#baseurl=http://mirror.centos.org/centos/\$releasever|baseurl=${MIRROR_URL}/centos-vault/5.11|g" \
-e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=${MIRROR_URL}/centos-vault/5.11|g" \
-i.bak /etc/yum.repos.d/*.repo; \
fi && \
if [ "$CHINA_MIRROR" != "0" ]; then \
bash ./docker/modify_yum_source.sh; \
fi && \
RUN export CHINA_MIRROR="$CHINA_MIRROR" && \
bash ./docker/modify_yum_source.sh && \
if [ "$VERSION_NUM" = "8" ]; then \
yum install -y perl perl-IPC-Cmd; \
elif [ "$VERSION_NUM" = "7" ] || [ "$VERSION_NUM" = "6" ]; then \

View File

@@ -10,21 +10,25 @@ WORKDIR /data
# Copy all files
COPY . /data
RUN if [ "$CHINA_MIRROR" != "0" ]; then \
if [ "$VERSION_NUM" = "9" ]; then \
RUN if [ "$VERSION_NUM" = "8" ]; then \
# This CentOS 8 stream had NO valid mirrors.
MIRROR_URL="https://vault.centos.org" && \
sed -e 's|^mirrorlist=|#mirrorlist=|g' \
-e "s|^#baseurl=http://mirror.centos.org/\$contentdir|baseurl=$MIRROR_URL|g" \
-i.bak \
/etc/yum.repos.d/CentOS-*.repo && \
yum install -y perl; \
else \
if [ "$CHINA_MIRROR" != "0" ]; then \
MIRROR_URL="https://mirrors.ustc.edu.cn" && \
sed -i "s|MIRROR_HOLDER|$MIRROR_URL/centos-stream|" /data/docker/modify_dnf_source.pl && \
yum install -y perl && \
perl /data/docker/modify_dnf_source.pl /etc/yum.repos.d/*.repo; \
elif [ "$VERSION_NUM" = "8" ]; then \
sed -e 's|^mirrorlist=|#mirrorlist=|g' \
-e 's|^#baseurl=http://mirror.centos.org/$contentdir|baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault|g' \
-i.bak \
/etc/yum.repos.d/CentOS-*.repo && \
yum install -y perl; \
fi \
fi; \
fi && \
yum clean all && yum makecache && \
yum groupinstall -y "Development Tools" && \
yum install -y rpm-build pam-devel krb5-devel zlib-devel libXt-devel libX11-devel gtk2-devel && \
yum install -y perl rpm-build pam-devel krb5-devel zlib-devel libXt-devel libX11-devel gtk2-devel && \
yum clean all && \
find . -type f -name '.keep' -delete && \
LINE_NO=$(grep -n -- "--define 'skip_x11_askpass 1'" /data/compile.sh | cut -d: -f1) && \

View File

@@ -4,7 +4,7 @@ use strict;
use warnings;
use autodie;
my $mirrors = 'https://mirrors.tuna.tsinghua.edu.cn/centos-stream';
my $mirrors = 'MIRROR_HOLDER';
if (@ARGV < 1) {
die "Usage: $0 <filename1> <filename2> ...\n";

View File

@@ -1,66 +1,102 @@
#!/bin/bash
# Author: Rex Chow
# Modified: 2024-07-04 11:18:49
# Modified: 2024-07-08 09:29:45
# Description: This script will modify yum repositories to Tsinghua University mirror.
# Copyright: Copyright © 2024 Rex Zhou. All rights reserved.
RELEASE_VER=$(rpm --eval '%{?dist}')
[ -z "$RELEASE_VER" ] && RELEASE_VER=".el5"
MIRROR_URL="http://mirrors.tuna.tsinghua.edu.cn"
AWS_REGION="cn-northwest-1"
# Cent OS 5 is NOT support modern SSL protocol, so use plain HTTP protocol.
if [ "$RELEASE_VER" != ".el5" ]; then
if [ "$CHINA_MIRROR" != "0" ]; then
# Using USTC mirror, which is much useful for Chinese users.
MIRROR_URL="https://mirrors.ustc.edu.cn/centos-vault";
AWS_DOMAIN="amazonaws.com.cn"
AWS_REGION="cn-northwest-1"
else
# Default mirror, the official mirror link.
MIRROR_URL="https://vault.centos.org/";
AWS_DOMAIN="amazonaws.com"
AWS_REGION="us-east-2"
fi
else
MIRROR_URL="http://linuxsoft.cern.ch"
fi
# For ARM platform, the mirror url needs a suffix `altarch`
if [ "$(uname -m)" = "aarch64" ]; then
OS_KEY="altarch"
if [ "$RELEASE_VER" != ".el8" ]; then
MIRROR_URL="$MIRROR_URL/$OS_KEY";
fi
else
OS_KEY="centos"
fi
function modify_el8() {
sed -e "s|^mirrorlist=|#mirrorlist=|g" \
-e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=${MIRROR_URL}/8.5.2111|g" \
-i.bak /etc/yum.repos.d/CentOS-*.repo && \
rm -rf /var/cache/yum/ && \
yum makecache timer
}
function modify_el7() {
sed -e 's|^mirrorlist=|#mirrorlist=|g' \
-e "s@^#baseurl=http://mirror.centos.org/$OS_KEY/\$releasever@baseurl=${MIRROR_URL}/7.9.2009@g" \
-e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=${MIRROR_URL}/7.9.2009|g" \
-i.bak /etc/yum.repos.d/CentOS-*.repo && \
rm -rf /var/cache/yum/ && \
yum makecache fast
}
function modify_el6() {
sed -e "s|^mirrorlist=|#mirrorlist=|g" \
-e "s|^#baseurl=http://mirror.centos.org/$OS_KEY/\$releasever|baseurl=${MIRROR_URL}/6.10|g" \
-e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=${MIRROR_URL}/6.10|g" \
-i.bak /etc/yum.repos.d/CentOS-*.repo && \
rm -rf /var/cache/yum/ && \
yum makecache fast
}
function modify_el5() {
sed -e "s|^mirrorlist=|#mirrorlist=|g" \
-e "s|^#baseurl=http://mirror.centos.org/centos/\$releasever|baseurl=${MIRROR_URL}/centos-vault/5.11|g" \
-e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=${MIRROR_URL}/centos-vault/5.11|g" \
-i.bak /etc/yum.repos.d/*.repo && \
rm -rf /var/cache/yum/ && \
yum makecache fast
}
case $RELEASE_VER in
.el8)
sed -e "s|^mirrorlist=|#mirrorlist=|g" \
-e "s|^baseurl=https://vault.centos.org|baseurl=${MIRROR_URL}/centos-vault|g" \
-i.bak /etc/yum.repos.d/CentOS-*.repo && \
rm -rf /var/cache/yum/ && \
yum makecache timer
modify_el8
;;
.el7)
if [ "$(uname -m)" = "aarch64" ]; then
sed -e 's|^mirrorlist=|#mirrorlist=|g' \
-e 's|^#baseurl=http://mirror.centos.org/altarch/|baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/altarch/|g' \
-e 's|^#baseurl=http://mirror.centos.org/$contentdir/|baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/altarch/|g' \
-i.bak /etc/yum.repos.d/CentOS-*.repo;
elif [ "$(uname -m)" = "x86_64" ]; then
sed -e 's|^mirrorlist=|#mirrorlist=|g' \
-e "s|^#baseurl=http://mirror.centos.org/centos/\$releasever|baseurl=${MIRROR_URL}/centos-vault/7.9.2009|g" \
-e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=${MIRROR_URL}/centos-vault/7.9.2009|g" \
-i.bak /etc/yum.repos.d/CentOS-*.repo;
fi && \
rm -rf /var/cache/yum/ && \
yum makecache fast
modify_el7
;;
.el6)
sed -e "s|^mirrorlist=|#mirrorlist=|g" \
-e "s|^#baseurl=http://mirror.centos.org/centos/\$releasever|baseurl=${MIRROR_URL}/centos-vault/6.10|g" \
-e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=${MIRROR_URL}/centos-vault/6.10|g" \
-i.bak /etc/yum.repos.d/CentOS-*.repo && \
rm -rf /var/cache/yum/ && \
yum makecache fast
modify_el6
;;
.el5)
sed -e "s|^mirrorlist=|#mirrorlist=|g" \
-e "s|^baseurl=http://archive.kernel.org|baseurl=${MIRROR_URL}|g" \
-i.bak /etc/yum.repos.d/*.repo && \
rm -rf /var/cache/yum/ && \
yum makecache fast
modify_el5
;;
.amzn1)
echo "amazonaws.com.cn" > /etc/yum/vars/awsdomain
echo "$AWS_DOMAIN" > /etc/yum/vars/awsdomain
echo "$AWS_REGION" > /etc/yum/vars/awsregion
;;
.amzn2)
echo "amazonaws.com.cn" > /etc/yum/vars/awsdomain
echo "$AWS_DOMAIN" > /etc/yum/vars/awsdomain
echo "$AWS_REGION" > /etc/yum/vars/awsregion
;;
.amzn2023)
echo "Amazon Linux 2023 is NOT need to change any settings."
echo "$AWS_DOMAIN" > /etc/dnf/vars/awsdomain
echo "$AWS_REGION" > /etc/dnf/vars/awsregion
;;
*)
echo "rpm dist undefined, please specify: el5 el6 el7"
exit 1
;;
esac
esac