-
Notifications
You must be signed in to change notification settings - Fork 4
96 lines (81 loc) · 2.69 KB
/
automation.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Build and release
on:
push:
branches: [ master ]
tags:
- '*'
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
release:
name: Release IPK to GitHub Releases
runs-on: ubuntu-latest
permissions:
contents: write
needs: build
steps:
- name: Branch name
id: branch_name
run: |
echo ::set-output name=IS_TAG::${{ startsWith(github.ref, 'refs/tags/') }}
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
echo ::set-output name=RELEASE_NAME::${GITHUB_REF#refs/*/}
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: ${{ env.ARTIFACT_NAME }}
- name: View content
run: ls -R
- name: Create master push pre-release
env:
IS_TAG: ${{ steps.branch_name.outputs.IS_TAG }}
RELEASE_NAME: ${{ steps.branch_name.outputs.RELEASE_NAME }}
if: "${{ env.IS_TAG == 'false' }}"
id: create_pre_release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.RELEASE_NAME }}-${{ github.run_number }}
name: ${{ env.RELEASE_NAME }}-${{ github.run_number }}
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
artifacts: ./*/*.ipk
- name: Create tagged release
env:
IS_TAG: ${{ steps.branch_name.outputs.IS_TAG }}
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
if: "${{ env.IS_TAG == 'true' }}"
id: create_release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.SOURCE_TAG }}
name: ${{ env.SOURCE_TAG }}
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: false
artifacts: ./*/*.ipk
build:
name: Build IPK package
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Get GitHub Build Number (ENV)
id: get_buildno
run: echo "GITHUBBUILDNUMBER=${{ github.run_number }}" >> $GITHUB_ENV
continue-on-error: true
- name: Get repository name
run: echo "REPOSITORY_NAME=$(echo '${{ github.repository }}' | cut -d '/' -f2)" >> $GITHUB_ENV
shell: bash
- name: Make artifact name
id: make_artifactname
run: |
ARTIFACT_NAME="${{ env.REPOSITORY_NAME }}-${{ github.run_number }}"
echo "${ARTIFACT_NAME}"
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
- name: Build IPK package
run: make
- name: Upload artifact containing all IPKs
uses: actions/upload-artifact@v2
with:
name: ${{ env.ARTIFACT_NAME }}
path: ./ipk/*.ipk