forked from project-stacker/stacker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically create releases on new tags
Fixed ci workflow trying to upload binary multiple times Signed-off-by: Petu Eusebiu <[email protected]>
- Loading branch information
1 parent
387d844
commit 0cbbe74
Showing
3 changed files
with
90 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Reusable stacker build | ||
on: | ||
workflow_call: | ||
inputs: | ||
go-version: | ||
required: true | ||
type: string | ||
description: 'Stringified JSON object listing go versions' | ||
privilege-level: | ||
required: true | ||
type: string | ||
description: 'Stringified JSON object listing stacker privilege-level' | ||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
go-version: ${{fromJson(inputs.go-version)}} | ||
privilege-level: ${{fromJson(inputs.privilege-level)}} | ||
name: "golang ${{ matrix.go-version }} privilege ${{ matrix.privilege-level }}" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up golang ${{ matrix.go-version }} | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -yy lxc-utils lxc-dev libacl1-dev jq libcap-dev libseccomp-dev libpam-dev bats parallel libzstd-dev | ||
GO111MODULE=off go get github.com/opencontainers/umoci/cmd/umoci | ||
sudo cp ~/go/bin/umoci /usr/bin | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin | ||
sudo apt-get install -yy autoconf automake make autogen autoconf libtool binutils git squashfs-tools libcryptsetup-dev libdevmapper-dev cryptsetup-bin | ||
(cd /tmp && git clone https://github.com/AgentD/squashfs-tools-ng && cd squashfs-tools-ng && ./autogen.sh && ./configure --prefix=/usr && make -j2 && sudo make -j2 install && sudo ldconfig -v) | ||
(cd /tmp && git clone https://github.com/anuvu/squashfs && cd squashfs && make && sudo cp squashtool/squashtool /usr/bin) | ||
- run: | | ||
make check PRIVILEGE_LEVEL=${{ matrix.privilege-level }} | ||
- uses: actions/cache@v2 | ||
id: restore-build | ||
with: | ||
path: stacker | ||
key: ${{ github.sha }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,19 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
- cron: '0 0 * * 0' # weekly | ||
release: | ||
types: | ||
- published | ||
push: | ||
pull_request: | ||
schedule: | ||
- cron: "0 0 * * 0" # weekly | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
name: "golang ${{ matrix.go-version }} privilege ${{ matrix.privilege-level }}" | ||
strategy: | ||
matrix: | ||
go-version: [1.17.x, 1.18.x] | ||
privilege-level: [priv, unpriv] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up golang ${{ matrix.go-version }} | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -yy lxc-utils lxc-dev libacl1-dev jq libcap-dev libseccomp-dev libpam-dev bats parallel libzstd-dev | ||
GO111MODULE=off go get github.com/opencontainers/umoci/cmd/umoci | ||
sudo cp ~/go/bin/umoci /usr/bin | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin | ||
sudo apt-get install -yy autoconf automake make autogen autoconf libtool binutils git squashfs-tools libcryptsetup-dev libdevmapper-dev cryptsetup-bin | ||
(cd /tmp && git clone https://github.com/AgentD/squashfs-tools-ng && cd squashfs-tools-ng && ./autogen.sh && ./configure --prefix=/usr && make -j2 && sudo make -j2 install && sudo ldconfig -v) | ||
(cd /tmp && git clone https://github.com/anuvu/squashfs && cd squashfs && make && sudo cp squashtool/squashtool /usr/bin) | ||
- run: | | ||
make check PRIVILEGE_LEVEL=${{ matrix.privilege-level }} | ||
- if: github.event_name == 'release' && github.event.action == 'published' | ||
name: Publish artifacts on releases | ||
uses: Roang-zero1/github-upload-release-artifacts-action@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
args: stacker | ||
ci: | ||
uses: ./.github/workflows/build.yaml | ||
with: | ||
go-version: >- | ||
["1.17.x", "1.18.x"] | ||
privilege-level: >- | ||
["unpriv", "priv"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: "tagged-release" | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
jobs: | ||
ci: | ||
uses: ./.github/workflows/build.yaml | ||
with: | ||
go-version: >- | ||
["1.17.x"] | ||
privilege-level: >- | ||
["priv"] | ||
release: | ||
name: "Tagged Release" | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/cache@v2 | ||
id: restore-build | ||
with: | ||
path: stacker | ||
key: ${{ github.sha }} | ||
- uses: marvinpinto/action-automatic-releases@latest | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
prerelease: false | ||
files: stacker | ||
|
||
|
||
|
||
|