|
1 | | -name: CI |
2 | | -on: [push, pull_request] |
| 1 | +name: ci |
| 2 | +on: |
| 3 | + pull_request: |
3 | 4 | jobs: |
4 | 5 | lint: |
5 | 6 | runs-on: ubuntu-latest |
@@ -52,122 +53,3 @@ jobs: |
52 | 53 | ${{ runner.os }}-go- |
53 | 54 | - name: Test |
54 | 55 | run: make test |
55 | | - release: |
56 | | - needs: |
57 | | - - lint |
58 | | - - build |
59 | | - - test |
60 | | - runs-on: ubuntu-latest |
61 | | - if: startsWith(github.ref, 'refs/tags/v') |
62 | | - steps: |
63 | | - - uses: actions/checkout@v3 |
64 | | - - name: Get tag version |
65 | | - id: get-tag-version |
66 | | - uses: actions/github-script@v6 |
67 | | - with: |
68 | | - result-encoding: string |
69 | | - script: | |
70 | | - return context.ref.replace(/^refs\/tags\/v/, ''); |
71 | | - - uses: mindsers/changelog-reader-action@v2 |
72 | | - id: read-changelog |
73 | | - with: |
74 | | - version: ${{ steps.get-tag-version.outputs.result }} |
75 | | - - uses: actions/create-release@v1 |
76 | | - id: create-release |
77 | | - env: |
78 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
79 | | - with: |
80 | | - tag_name: ${{ github.ref }} |
81 | | - release_name: v${{ steps.read-changelog.outputs.version }} |
82 | | - body: ${{ steps.read-changelog.outputs.changes }} |
83 | | - prerelease: ${{ steps.read-changelog.outputs.status == 'prereleased' }} |
84 | | - draft: ${{ steps.read-changelog.outputs.status == 'unreleased' }} |
85 | | - outputs: |
86 | | - upload-url: ${{ steps.create-release.outputs.upload_url }} |
87 | | - release-assets: |
88 | | - needs: release |
89 | | - runs-on: ubuntu-latest |
90 | | - strategy: |
91 | | - matrix: |
92 | | - include: |
93 | | - - os: darwin |
94 | | - arch: amd64 |
95 | | - - os: windows |
96 | | - arch: amd64 |
97 | | - - os: windows |
98 | | - arch: '386' |
99 | | - - os: linux |
100 | | - arch: amd64 |
101 | | - - os: linux |
102 | | - arch: '386' |
103 | | - - os: linux |
104 | | - arch: arm64 |
105 | | - - os: linux |
106 | | - arch: arm |
107 | | - - os: freebsd |
108 | | - arch: amd64 |
109 | | - - os: freebsd |
110 | | - arch: '386' |
111 | | - - os: freebsd |
112 | | - arch: arm |
113 | | - - os: netbsd |
114 | | - arch: amd64 |
115 | | - - os: netbsd |
116 | | - arch: '386' |
117 | | - - os: openbsd |
118 | | - arch: amd64 |
119 | | - - os: openbsd |
120 | | - arch: '386' |
121 | | - - os: solaris |
122 | | - arch: amd64 |
123 | | - steps: |
124 | | - - uses: actions/checkout@v4 |
125 | | - - uses: actions/setup-go@v5 |
126 | | - with: |
127 | | - go-version-file: 'go.mod' |
128 | | - - uses: actions/cache@v3 |
129 | | - with: |
130 | | - path: | |
131 | | - ~/go/pkg/mod |
132 | | - ~/go/pkg/sumdb |
133 | | - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
134 | | - restore-keys: | |
135 | | - ${{ runner.os }}-go- |
136 | | - - name: Build |
137 | | - env: |
138 | | - PLUGIN_DIST_OS: ${{ matrix.os }} |
139 | | - PLUGIN_DIST_ARCH: ${{ matrix.arch }} |
140 | | - run: | |
141 | | - make "dist-bin-${PLUGIN_DIST_OS}-${PLUGIN_DIST_ARCH}" |
142 | | - - name: Get asset information |
143 | | - id: get-asset-information |
144 | | - run: | |
145 | | - archive_name="$( find ./artifacts/ -type f -not -name '*.sha256.asc' -printf '%f\n' )" |
146 | | - archive_media_type="$( file -b --mime-type "./artifacts/${archive_name}" )" |
147 | | -
|
148 | | - checksum_name="${archive_name}.sha256.asc" |
149 | | - checksum_media_type="$( file -b --mime-type "./artifacts/${checksum_name}" )" |
150 | | -
|
151 | | - echo "archive-name=${archive_name}" >>"$GITHUB_OUTPUT" |
152 | | - echo "archive-media-type=${archive_media_type}" >>"$GITHUB_OUTPUT" |
153 | | -
|
154 | | - echo "checksum-name=${checksum_name}" >>"$GITHUB_OUTPUT" |
155 | | - echo "checksum-media-type=${checksum_media_type}" >>"$GITHUB_OUTPUT" |
156 | | - - name: Upload checksum asset |
157 | | - uses: actions/upload-release-asset@v1 |
158 | | - env: |
159 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
160 | | - with: |
161 | | - upload_url: ${{ needs.release.outputs.upload-url }} |
162 | | - asset_path: ./artifacts/${{ steps.get-asset-information.outputs.checksum-name }} |
163 | | - asset_name: ${{ steps.get-asset-information.outputs.checksum-name }} |
164 | | - asset_content_type: ${{ steps.get-asset-information.outputs.checksum-media-type }} |
165 | | - - name: Upload archive asset |
166 | | - uses: actions/upload-release-asset@v1 |
167 | | - env: |
168 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
169 | | - with: |
170 | | - upload_url: ${{ needs.release.outputs.upload-url }} |
171 | | - asset_path: ./artifacts/${{ steps.get-asset-information.outputs.archive-name }} |
172 | | - asset_name: ${{ steps.get-asset-information.outputs.archive-name }} |
173 | | - asset_content_type: ${{ steps.get-asset-information.outputs.archive-media-type }} |
0 commit comments