Skip to content

[chore] go.mod fix #454

[chore] go.mod fix

[chore] go.mod fix #454

Workflow file for this run

name: Release
on:
create:
tags:
- v*
pull_request:
branches:
- "main"
env:
GOPRIVATE: "${{secrets.SOURCE_REPO_GIT}}"
SOURCE_REPO_GIT: "${{secrets.SOURCE_REPO_GIT}}"
permissions:
contents: write
jobs:
release:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: [self-hosted, regular]
container:
image: ubuntu:22.04
steps:
- name: Install dependency for linux-amd64 dist
env:
DEBIAN_FRONTEND: noninteractive
run: apt-get update && apt-get install -y apt-utils libbtrfs-dev file git gcc
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # To use `git describe --tags`
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
cache: false # Cache download takes longer that a build from scratch
- name: Setup Task
uses: arduino/setup-task@v2
- name: Start ssh-agent
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: |
${{secrets.SOURCE_REPO_SSH_KEY}}
- name: Add ssh_known_hosts
run: |
HOST=${{secrets.SOURCE_REPO_GIT}}
echo "::add-mask::$HOST"
IPS=$(nslookup "$HOST" | awk '/^Address: / { print $2 }')
for IP in $IPS; do
echo "::add-mask::$IP"
done
mkdir -p ~/.ssh
touch ~/.ssh/known_hosts
HOST_KEYS=$(ssh-keyscan -H "$HOST" 2>/dev/null)
while IFS= read -r KEY_LINE; do
CONSTANT_PART=$(awk '{print $2, $3}' <<< "$KEY_LINE")
if ! grep -q "$CONSTANT_PART" ~/.ssh/known_hosts; then
echo "$KEY_LINE" >> ~/.ssh/known_hosts
fi
done <<< "$HOST_KEYS"
- name: Setup git
run: |
git config --global url."ssh://git@${PRIVATE_REPO}/".insteadOf "https://flant.internal/"
git config --global --add safe.directory '*'
- name: Build and package
run: task build-and-package
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
dist/**/*.tar.gz
dist/**/*.tar.gz.sha256sum
test:
if: github.event_name == 'pull_request'
runs-on: [self-hosted, regular]
container:
image: ubuntu:22.04
steps:
- name: Install dependency for linux-amd64 dist
env:
DEBIAN_FRONTEND: noninteractive
run: apt-get update && apt-get install -y apt-utils libbtrfs-dev file git gcc
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # To use `git describe --tags`
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
cache: false # Cache download takes longer that a build from scratch
- name: Setup Task
uses: arduino/setup-task@v2
- name: Start ssh-agent
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: |
${{secrets.SOURCE_REPO_SSH_KEY}}
- name: Add ssh_known_hosts
run: |
HOST=${{secrets.SOURCE_REPO_GIT}}
echo "::add-mask::$HOST"
IPS=$(nslookup "$HOST" | awk '/^Address: / { print $2 }')
for IP in $IPS; do
echo "::add-mask::$IP"
done
mkdir -p ~/.ssh
touch ~/.ssh/known_hosts
HOST_KEYS=$(ssh-keyscan -H "$HOST" 2>/dev/null)
while IFS= read -r KEY_LINE; do
CONSTANT_PART=$(awk '{print $2, $3}' <<< "$KEY_LINE")
if ! grep -q "$CONSTANT_PART" ~/.ssh/known_hosts; then
echo "$KEY_LINE" >> ~/.ssh/known_hosts
fi
done <<< "$HOST_KEYS"
- name: Setup git
run: |
git config --global url."ssh://git@${SOURCE_REPO_GIT}/".insteadOf "https://flant.internal/"
git config --global --add safe.directory '*'
- name: Run tests
run: task test