Skip to content

Docker Image CI

Docker Image CI #1009

Workflow file for this run

name: Docker Image CI
on:
schedule:
- cron: '0 */24 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Prepare workspace
run: mkdir workspace
- name: Build the WireGuard binary (wireguard-go)
run: |
cat build-wg-go.sh | docker run --rm -i -v="$PWD/workspace:/workspace" -w="/workspace" golang:latest sh
ls ./workspace/wireguard-go*
- name: Get version
id: getver
run: echo "::set-output name=body::`./workspace/wireguard-go --version | head -n 1 | cut -d ' ' -f 2`"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.getver.outputs.body }}
release_name: Release ${{ steps.getver.outputs.body }}
body: Binary build of WireGuard written in Golang.
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const path = require('path');
const fs = require('fs');
const release_id = '${{ steps.create_release.outputs.id }}';
for (let file of await fs.readdirSync('./workspace/')) {
if (file.startsWith("wireguard-go")) {
console.log('uploadReleaseAsset', file);
await github.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release_id,
name: file,
data: await fs.readFileSync(`./workspace/${file}`)
});
}
}