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: on:
push: push:
branches: tags:
- master - v*
jobs: 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: build-releases:
strategy: strategy:
matrix: matrix:
arch: ["x86_64", "armv7h", "aarch64"] arch: ["x86_64", "armv7h", "aarch64"]
name: Build ${{ matrix.arch }} name: Build ${{ matrix.arch }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [tag]
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: env
- name: Read info - name: Read info
id: tags id: tags
shell: bash shell: bash
run: | 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 - name: Install dependencies
run: sudo apt update -y && sudo apt install -y qemu qemu-user-static run: sudo apt update -y && sudo apt install -y qemu qemu-user-static
- name: Setup qemu-user-static - name: Setup qemu-user-static
@ -54,7 +29,7 @@ jobs:
mkdir artifacts mkdir artifacts
make docker-release-${{ matrix.arch }} ARCH=${{ matrix.arch }} VERSION=${{ steps.tags.outputs.version }} make docker-release-${{ matrix.arch }} ARCH=${{ matrix.arch }} VERSION=${{ steps.tags.outputs.version }}
mv *.tar.gz artifacts mv *.tar.gz artifacts
- uses: actions/upload-artifact@master - uses: actions/upload-artifact@v2
with: with:
name: yay_${{ matrix.arch }} name: yay_${{ matrix.arch }}
path: artifacts path: artifacts
@ -63,18 +38,17 @@ jobs:
needs: [build-releases] needs: [build-releases]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: env
- name: Read info - name: Read info
id: tags id: tags
shell: bash shell: bash
run: | run: |
echo ::set-output name=VERSION::$(cat new_version) echo ::set-output name=VERSION::${GITHUB_REF#/refs/tags/v}
echo ::set-output name=TAG::$(cat new_tag) echo ::set-output name=TAG::${GITHUB_REF#/refs/tags/}
echo ::set-output name=CHANGELOG::$(cat changelog) - name: Changelog
uses: scottbrenner/generate-changelog-action@master
id: changelog
env:
REPO: ${{ github.repository }}
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v2
with: with:
name: yay_x86_64 name: yay_x86_64
@ -92,7 +66,8 @@ jobs:
with: with:
tag_name: ${{ steps.tags.outputs.tag }} tag_name: ${{ steps.tags.outputs.tag }}
release_name: ${{ steps.tags.outputs.tag }} release_name: ${{ steps.tags.outputs.tag }}
body: ${{ steps.tags.outputs.changelog }} body: |
${{ steps.changelog.outputs.changelog }}
draft: false draft: false
prerelease: false prerelease: false
- name: Upload x86_64 asset - 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/**" - "doc/**"
- "README.md" - "README.md"
- ".gitignore" - ".gitignore"
branches-ignore:
- "master"
pull_request: pull_request:
jobs: jobs:
@ -26,6 +28,6 @@ jobs:
- name: Run Build and tests - name: Run Build and tests
run: | run: |
pacman -Sy --noconfirm go 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 ./... ./bin/golangci-lint run ./...
make test make test

View file

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