1
0

create github actions

This commit is contained in:
Anagani Sai Kiran 2021-10-22 23:33:59 +05:30 committed by Sai Kiran
parent 14b211109c
commit 1481ba9c86
4 changed files with 54 additions and 82 deletions

View File

@ -1,46 +0,0 @@
version: 2
jobs:
build:
docker:
- image: circleci/golang:1.11
working_directory: ~/app
steps:
- checkout
- run:
name: Build
command: |
./ci-build-script.sh .
cp ./digitalocean-dynamic-ip.sample.json ./releases/
- persist_to_workspace:
root: .
paths:
- ./releases
publish-github-release:
docker:
- image: cibuilds/github:0.10
working_directory: ~/app
steps:
- attach_workspace:
at: ~/app
- run:
name: "Publish Release on GitHub"
command: |
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${CIRCLE_TAG} ./releases/
workflows:
version: 2
main:
jobs:
- build:
filters:
tags:
only: /^\d+\.\d+\.\d+$/
- publish-github-release:
requires:
- build
filters:
branches:
ignore: /.*/
tags:
only: /^\d+\.\d+\.\d+$/

53
.github/workflows/go.yml vendored Normal file
View File

@ -0,0 +1,53 @@
name: Go
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.11
- name: Build
run: |
#see https://en.wikipedia.org/wiki/Raspberry_Pi#Specifications for RPi arm versions
#see https://github.com/golang/go/wiki/GoArm
platforms=("windows/amd64" "windows/386" "darwin/amd64" "linux/386" "linux/amd64" "linux/arm/6" "linux/arm/7" "linux/arm64/8" "freebsd/386" "freebsd/amd64")
mkdir -p releases
for platform in "${platforms[@]}"
do
platform_split=(${platform//\// })
GOOS=${platform_split[0]}
GOARCH=${platform_split[1]}
GOARM=${platform_split[2]}
output_name='digitalocean-dynamic-dns-ip-'$GOOS'-'$GOARCH
if [[ ! -z "$GOARM" ]]; then
output_name+="v${GOARM}"
# arm v8 is only supported for ARCH=arm64 and requires an empty GOARM version
if [[ "8" -eq "$GOARM" ]]; then
GOARM=""
fi
fi
if [ $GOOS = "windows" ]; then
output_name+='.exe'
fi
env GOOS="$GOOS" GOARCH="$GOARCH" GOARM="$GOARM" go build -o "releases/$output_name"
if [ $? -ne 0 ]; then
echo 'An error has occurred! Aborting the script execution...'
exit 1
fi
done
- uses: ncipollo/release-action@v1
name: "Create Release"
with:
artifacts: "releases/*"
token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,4 +1,4 @@
# DIGITAL OCEAN DYNAMIC IP API CLIENT [![CircleCI](https://circleci.com/gh/anaganisk/digitalocean-dynamic-dns-ip/tree/master.svg?style=svg)](https://circleci.com/gh/anaganisk/digitalocean-dynamic-dns-ip/tree/master) # DIGITAL OCEAN DYNAMIC IP API CLIENT
A simple script in Go language to automatically update Digital ocean DNS records if you have a dynamic IP. Since it can be compiled on any platform, you can use it along with raspberrypi etc. A simple script in Go language to automatically update Digital ocean DNS records if you have a dynamic IP. Since it can be compiled on any platform, you can use it along with raspberrypi etc.

View File

@ -1,35 +0,0 @@
#!/bin/bash
package=$1
if [[ -z "$package" ]]; then
echo "usage: $0 <package-name>"
exit 1
fi
package_split=(${package//\// })
package_name=${package_split[-1]}
#see https://en.wikipedia.org/wiki/Raspberry_Pi#Specifications for RPi arm versions
#see https://github.com/golang/go/wiki/GoArm
platforms=("windows/amd64" "windows/386" "darwin/amd64" "linux/386" "linux/amd64" "linux/arm/6" "linux/arm/7" "linux/arm64/8" "freebsd/386" "freebsd/amd64")
mkdir -p releases
for platform in "${platforms[@]}"
do
platform_split=(${platform//\// })
GOOS=${platform_split[0]}
GOARCH=${platform_split[1]}
GOARM=${platform_split[2]}
output_name='digitalocean-dynamic-dns-ip-'$GOOS'-'$GOARCH
if [[ ! -z "$GOARM" ]]; then
output_name+="v${GOARM}"
# arm v8 is only supported for ARCH=arm64 and requires an empty GOARM version
if [[ "8" -eq "$GOARM" ]]; then
GOARM=""
fi
fi
if [ $GOOS = "windows" ]; then
output_name+='.exe'
fi
env GOOS="$GOOS" GOARCH="$GOARCH" GOARM="$GOARM" go build -o "releases/$output_name" "$package_name"
if [ $? -ne 0 ]; then
echo 'An error has occurred! Aborting the script execution...'
exit 1
fi
done