Skip to content

Commit

Permalink
修改:修改了自动化构建的流程,现在可以自动构建了
Browse files Browse the repository at this point in the history
修改:新增打包的文件位置
  • Loading branch information
MemoryShadow committed Jul 24, 2021
1 parent e0c2893 commit c764acb
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 10 deletions.
68 changes: 58 additions & 10 deletions .github/workflows/blank.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,23 @@ name: CI
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
branches:
- master
tags:
- 'v*.*.*'
pull_request:
branches: [ master ]
branches:
- master
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:
# This workflow contains a single job called "build"
build-ubuntu:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

Expand All @@ -25,12 +31,54 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

# Runs a single command using the runners shell
- name: Run a one-line script
run: echo Hello, world!
- name: Build-deb
if: startsWith(github.ref, 'refs/tags/')
env:
CURRENT_TAG: ${{ steps.version_tag.outputs.VERSION }}
run: |
pwd
work_path=`pwd`
cd /home/runner/work/minecraftctl/minecraftctl/deb
mkdir -p ./usr/sbin ./etc/minecraftctl
cp -f ../bin/minecraftctl ./usr/sbin/
cp -f ../cfg/config ./etc/minecraftctl/
chmod 755 ./usr/sbin/*
chmod 644 ./etc/minecraftctl/*
dpkg -i . ${work_path}/minecraftctl_${CURRENT_TAG}_i386.deb
cd ..
git log --pretty=format:"%s" -1>${work_path}/CHANGELOG.md
cd ${work_path}
# Runs a set of commands using the runners shell
- name: Run a multi-line script
- name: Build-rpm
if: startsWith(github.ref, 'refs/tags/')
env:
CURRENT_TAG: ${{ steps.version_tag.outputs.VERSION }}
run: |
echo Add other actions to build,
echo test, and deploy your project.
pwd
ls -lab
work_path=`pwd`
docker run -itd -v /home/runner/work/minecraftctl/minecraftctl/:/home/runner/work/minecraftctl/minecraftctl/ --name centos7Instance --net="host" docker.io/centos:7 /bin/bash
yum install -y rpmdevtools
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
cd /home/runner/work/minecraftctl/minecraftctl/
cp -r ./bin ~/rpmbuild/
cp -r ./cfg ~/rpmbuild/
cp ./rpm/SPECS/minecraftctl.spec ~/rpmbuild/SPECS/
rpmbuild --target x86_64 -bb ~/rpmbuild/SPECS/minecraftctl.spec
cp ~/rpmbuild/SRPMS/minecraftctl-${CURRENT_TAG}-1.el7.x86_64.rpm /home/runner/work/minecraftctl/minecraftctl/
exit
cd ${work_path}
cp /home/runner/work/minecraftctl/minecraftctl/minecraftctl-${CURRENT_TAG}-1.el7.x86_64.rpm ./
ls -lab
# Releases
- name: Releases
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG.md
files: |
minecraftctl_${CURRENT_TAG}_i386.deb
minecraftctl-${CURRENT_TAG}-1.el7.x86_64.rpm
env:
CURRENT_TAG: ${{ steps.version_tag.outputs.VERSION }}
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ chmod 644 ./etc/minecraftctl/*
dpkg -i . ../minecraftctl_1.0.1_i386.deb
```

打包后的文件将会出现在git仓库的根目录

### rpm格式

```bash
Expand All @@ -58,3 +60,5 @@ cp ./rpm/SPECS/minecraftctl.spec ~/rpmbuild/SPECS/
# 运行构建
rpmbuild --target x86_64 -bb ~/rpmbuild/SPECS/minecraftctl.spec
```

打包好的文件将会出现在您设备的`~/rpmbuild/SRPMS/`目录下

0 comments on commit c764acb

Please sign in to comment.