Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
gost
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
gost
Commits
9f1f492b
Commit
9f1f492b
authored
Mar 14, 2020
by
ginuerzh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add workflow for github actions
parent
2c0e01a5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
0 deletions
+82
-0
.github/workflows/buildx.yaml
.github/workflows/buildx.yaml
+82
-0
No files found.
.github/workflows/buildx.yaml
0 → 100644
View file @
9f1f492b
# ref: https://github.com/crazy-max/diun/blob/master/.github/workflows/build.yml
name
:
Docker
on
:
[
push
]
jobs
:
build
:
runs-on
:
ubuntu-18.04
steps
:
-
name
:
Prepare
id
:
prepare
run
:
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
echo ::set-output name=version::${GITHUB_REF#refs/tags/v}
elif [[ $GITHUB_REF == refs/heads/master ]]; then
echo ::set-output name=version::latest
elif [[ $GITHUB_REF == refs/heads/* ]]; then
echo ::set-output name=version::${GITHUB_REF#refs/heads/}
else
echo ::set-output name=version::snapshot
fi
echo ::set-output name=build_date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
echo ::set-output name=docker_platforms::linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le,linux/s390x
echo ::set-output name=docker_image::${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}
# https://github.com/crazy-max/ghaction-docker-buildx
-
name
:
Set up Docker Buildx
id
:
buildx
uses
:
crazy-max/ghaction-docker-buildx@v1
with
:
version
:
latest
-
name
:
Environment
run
:
|
echo home=$HOME
echo git_ref=$GITHUB_REF
echo git_sha=$GITHUB_SHA
echo version=${{ steps.prepare.outputs.version }}
echo date=${{ steps.prepare.outputs.build_date }}
echo image=${{ steps.prepare.outputs.docker_image }}
echo platforms=${{ steps.prepare.outputs.docker_platforms }}
echo avail_platforms=${{ steps.buildx.outputs.platforms }}
# https://github.com/actions/checkout
-
name
:
Checkout
uses
:
actions/checkout@v2
-
name
:
Docker Buildx (no push)
run
:
|
docker buildx build \
--platform ${{ steps.prepare.outputs.docker_platforms }} \
--output "type=image,push=false" \
--build-arg "VERSION=${{ steps.prepare.outputs.version }}" \
--build-arg "BUILD_DATE=${{ steps.prepare.outputs.build_date }}" \
--build-arg "VCS_REF=${GITHUB_SHA::8}" \
--tag "${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}" \
--file Dockerfile .
-
name
:
Docker Login
if
:
success()
env
:
DOCKER_PASSWORD
:
${{ secrets.DOCKER_PASSWORD }}
run
:
|
echo "${DOCKER_PASSWORD}" | docker login --username "${{ secrets.DOCKER_USERNAME }}" --password-stdin
-
name
:
Docker Buildx (push)
if
:
success()
run
:
|
docker buildx build \
--platform ${{ steps.prepare.outputs.docker_platforms }} \
--output "type=image,push=true" \
--build-arg "VERSION=${{ steps.prepare.outputs.version }}" \
--build-arg "BUILD_DATE=${{ steps.prepare.outputs.build_date }}" \
--build-arg "VCS_REF=${GITHUB_SHA::8}" \
--tag "${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}" \
--file Dockerfile .
-
name
:
Clear
if
:
always()
run
:
|
rm -f ${HOME}/.docker/config.json
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment