fix(ci): refactor CI

This commit is contained in:
jguer 2020-06-13 23:20:22 +02:00
parent d003e96e07
commit d3f9335d2d
No known key found for this signature in database
GPG key ID: 6D6CC9BEA8556B35
4 changed files with 36 additions and 42 deletions

View file

@ -1,50 +1,25 @@
name: Release
name: Build Release
on:
push:
branches:
- master
tags:
- v*
jobs:
tag:
name: Tag release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: mathieudutour/github-tag-action@v4.5
id: tag_version
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: "v"
create_annotated_tag: true
- name: share variables
shell: bash
run: |
mkdir env
echo ${{ steps.tag_version.outputs.new_version }} > env/new_version
echo ${{ steps.tag_version.outputs.new_tag }} > env/new_tag
echo "${{ steps.tag_version.outputs.changelog }}" > env/changelog
- uses: actions/upload-artifact@v1
with:
name: env
path: env
build-releases:
strategy:
matrix:
arch: ["x86_64", "armv7h", "aarch64"]
name: Build ${{ matrix.arch }}
runs-on: ubuntu-latest
needs: [tag]
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: env
- name: Read info
id: tags
shell: bash
run: |
echo ::set-output name=VERSION::$(cat new_version)
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
@ -54,7 +29,7 @@ jobs:
mkdir artifacts
make docker-release-${{ matrix.arch }} ARCH=${{ matrix.arch }} VERSION=${{ steps.tags.outputs.version }}
mv *.tar.gz artifacts
- uses: actions/upload-artifact@master
- uses: actions/upload-artifact@v2
with:
name: yay_${{ matrix.arch }}
path: artifacts
@ -63,18 +38,17 @@ jobs:
needs: [build-releases]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: env
- name: Read info
id: tags
shell: bash
run: |
echo ::set-output name=VERSION::$(cat new_version)
echo ::set-output name=TAG::$(cat new_tag)
echo ::set-output name=CHANGELOG::$(cat changelog)
echo ::set-output name=VERSION::${GITHUB_REF#/refs/tags/v}
echo ::set-output name=TAG::${GITHUB_REF#/refs/tags/}
- name: Changelog
uses: scottbrenner/generate-changelog-action@master
id: changelog
env:
REPO: ${{ github.repository }}
- uses: actions/download-artifact@v2
with:
name: yay_x86_64
@ -92,7 +66,8 @@ jobs:
with:
tag_name: ${{ steps.tags.outputs.tag }}
release_name: ${{ steps.tags.outputs.tag }}
body: ${{ steps.tags.outputs.changelog }}
body: |
${{ steps.changelog.outputs.changelog }}
draft: false
prerelease: false
- name: Upload x86_64 asset

17
.github/workflows/tag.yml vendored Normal file
View file

@ -0,0 +1,17 @@
name: Tag
on:
push:
branches:
- master
jobs:
tag:
name: Tag release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: mathieudutour/github-tag-action@v4.5
id: tag_version
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: "v"

View file

@ -6,6 +6,8 @@ on:
- "doc/**"
- "README.md"
- ".gitignore"
branches-ignore:
- "master"
pull_request:
jobs:
@ -26,6 +28,6 @@ jobs:
- name: Run Build and tests
run: |
pacman -Sy --noconfirm go
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.26.0
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.27.0
./bin/golangci-lint run ./...
make test

View file

@ -136,7 +136,7 @@ $(BIN): $(SOURCES)
$(RELEASE_DIR):
mkdir $(RELEASE_DIR)
$(PACKAGE): $(BIN) $(RELEASE_DIR)
$(PACKAGE): $(BIN) $(RELEASE_DIR) ${MOFILES}
cp -t $(RELEASE_DIR) ${BIN} doc/${PKGNAME}.8 completions/* ${MOFILES}
tar -czvf $(PACKAGE) $(RELEASE_DIR)