mirror of
https://github.com/appleboy/drone-ssh.git
synced 2026-06-16 14:49:25 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cc7a2d5983 | |||
| 0a6e4de21c | |||
| 48f817effb |
@@ -9,7 +9,19 @@ on:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
max-parallel: 3
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
system: [linux]
|
||||
arch: [amd64, arm, arm64]
|
||||
# support windows build and push?
|
||||
# see the issue: https://github.com/docker/build-push-action/issues/18
|
||||
# include:
|
||||
# - os: windows-2022
|
||||
# system: windows
|
||||
# arch: amd64
|
||||
steps:
|
||||
- name: Setup go
|
||||
uses: actions/setup-go@v3
|
||||
@@ -22,17 +34,17 @@ jobs:
|
||||
|
||||
- name: Build binary
|
||||
run : |
|
||||
make build_linux_amd64
|
||||
make build_linux_arm64
|
||||
make build_linux_arm
|
||||
make build_${{ matrix.system }}_${{ matrix.arch }}
|
||||
|
||||
- name: Check binary
|
||||
if: matrix.system == 'linux' && matrix.arch == 'amd64'
|
||||
run : |
|
||||
./release/linux/amd64/drone-ssh --help
|
||||
./release/${{ matrix.system }}/${{ matrix.arch }}/${GITHUB_REPOSITORY#*/} --help
|
||||
|
||||
-
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
@@ -53,86 +65,30 @@ jobs:
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
-
|
||||
name: Docker meta for linux amd64
|
||||
id: meta-linux-amd64
|
||||
name: Docker meta for ${{ matrix.system }} ${{ matrix.arch }}
|
||||
id: docker-meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
flavor: |
|
||||
latest=false
|
||||
suffix=linux-amd64
|
||||
suffix=${{ matrix.system }}-${{ matrix.arch }}
|
||||
images: |
|
||||
appleboy/drone-ssh
|
||||
ghcr.io/appleboy/drone-ssh
|
||||
${{ github.repository }}
|
||||
ghcr.io/${{ github.repository }}
|
||||
tags: |
|
||||
type=raw,value=,enable={{is_default_branch}}
|
||||
type=raw,value=latest,suffix=,enable={{is_default_branch}}
|
||||
type=semver,event=tag,pattern={{version}},suffix=-linux-amd64
|
||||
type=semver,event=tag,pattern={{major}}.{{minor}},suffix=-linux-amd64
|
||||
type=semver,event=tag,pattern={{major}},suffix=-linux-amd64
|
||||
type=raw,value=latest,suffix=,enable=${{ matrix.system == 'linux' && matrix.arch == 'amd64' }}
|
||||
type=semver,event=tag,pattern={{version}},suffix=-${{ matrix.system }}-${{ matrix.arch }}
|
||||
type=semver,event=tag,pattern={{major}}.{{minor}},suffix=-${{ matrix.system }}-${{ matrix.arch }}
|
||||
type=semver,event=tag,pattern={{major}},suffix=-${{ matrix.system }}-${{ matrix.arch }}
|
||||
|
||||
-
|
||||
name: Build and push linux amd64
|
||||
name: Build and push ${{ matrix.system }} ${{ matrix.arch }}
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
file: docker/Dockerfile.linux.amd64
|
||||
platforms: linux/amd64
|
||||
file: docker/Dockerfile.${{ matrix.system }}.${{ matrix.arch }}
|
||||
platforms: ${{ matrix.system }}/${{ matrix.arch }}
|
||||
push: true
|
||||
tags: ${{ steps.meta-linux-amd64.outputs.tags }}
|
||||
labels: ${{ steps.meta-linux-amd64.outputs.labels }}
|
||||
|
||||
-
|
||||
name: Docker meta for linux arm64
|
||||
id: meta-linux-arm64
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
flavor: |
|
||||
latest=false
|
||||
suffix=linux-arm64
|
||||
images: |
|
||||
appleboy/drone-ssh
|
||||
ghcr.io/appleboy/drone-ssh
|
||||
tags: |
|
||||
type=raw,value=,enable={{is_default_branch}}
|
||||
type=semver,event=tag,pattern={{version}},suffix=-linux-arm64
|
||||
type=semver,event=tag,pattern={{major}}.{{minor}},suffix=-linux-arm64
|
||||
type=semver,event=tag,pattern={{major}},suffix=-linux-arm64
|
||||
|
||||
-
|
||||
name: Build and push linux arm64
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
file: docker/Dockerfile.linux.arm64
|
||||
platforms: linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta-linux-arm64.outputs.tags }}
|
||||
labels: ${{ steps.meta-linux-arm64.outputs.labels }}
|
||||
|
||||
-
|
||||
name: Docker meta for linux arm
|
||||
id: meta-linux-arm
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
flavor: |
|
||||
latest=false
|
||||
suffix=linux-arm
|
||||
images: |
|
||||
appleboy/drone-ssh
|
||||
ghcr.io/appleboy/drone-ssh
|
||||
tags: |
|
||||
type=raw,value=,enable={{is_default_branch}}
|
||||
type=semver,event=tag,pattern={{version}},suffix=-linux-arm
|
||||
type=semver,event=tag,pattern={{major}}.{{minor}},suffix=-linux-arm
|
||||
type=semver,event=tag,pattern={{major}},suffix=-linux-arm
|
||||
|
||||
-
|
||||
name: Build and push linux arm
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
file: docker/Dockerfile.linux.arm
|
||||
platforms: linux/arm
|
||||
push: true
|
||||
tags: ${{ steps.meta-linux-arm.outputs.tags }}
|
||||
labels: ${{ steps.meta-linux-arm.outputs.labels }}
|
||||
tags: ${{ steps.docker-meta.outputs.tags }}
|
||||
labels: ${{ steps.docker-meta.outputs.labels }}
|
||||
|
||||
@@ -103,7 +103,7 @@ func (p Plugin) exec(host string, wg *sync.WaitGroup, errChannel chan error) {
|
||||
for _, key := range p.Config.Envs {
|
||||
key = strings.ToUpper(key)
|
||||
if val, found := os.LookupEnv(key); found {
|
||||
env = append(env, key+"="+escapeArg(val))
|
||||
env = append(env, "export "+key+"="+escapeArg(val))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -539,13 +539,13 @@ func TestEnvOutput(t *testing.T) {
|
||||
echo "[${ENV_7}]"
|
||||
======END======
|
||||
======ENV======
|
||||
ENV_1='test'
|
||||
ENV_2='test test'
|
||||
ENV_3='test '
|
||||
ENV_4=' test test '
|
||||
ENV_5='test'\'''
|
||||
ENV_6='test"'
|
||||
ENV_7='test,!#;?.@$~'\''"'
|
||||
export ENV_1='test'
|
||||
export ENV_2='test test'
|
||||
export ENV_3='test '
|
||||
export ENV_4=' test test '
|
||||
export ENV_5='test'\'''
|
||||
export ENV_6='test"'
|
||||
export ENV_7='test,!#;?.@$~'\''"'
|
||||
======END======
|
||||
out: [test]
|
||||
out: [test test]
|
||||
|
||||
Reference in New Issue
Block a user