Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions .github/workflows/release-linux.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
on:
release:
types: [published]
pull_request:
branches:
- master
name: Build Release Binary (Linux)
jobs:
build:
Expand All @@ -10,37 +13,49 @@ jobs:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt install libssl-dev
- name: Build binary
run: make
- name: artifacts name
id: artifacts-name
env:
IS_RELEASE: ${{ github.event_name == 'release' }}
run: |
if [ "$IS_RELEASE" = true ]; then
echo "artifacts-name=git-crypt-artifacts" >> $GITHUB_ENV
else
echo "artifacts-name=git-crypt-artifacts-dev" >> $GITHUB_ENV
fi
- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: git-crypt-artifacts
name: ${{ env.artifacts-name }}
path: git-crypt
upload:
name: Upload Release Binary
if: github.event_name == 'release'
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
steps:
- name: Download release artifact
uses: actions/download-artifact@v4
uses: actions/download-artifact@v2
with:
name: git-crypt-artifacts
- name: Upload release asset
uses: actions/github-script@v3
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require("fs").promises;
const { repo: { owner, repo }, sha } = context;
await github.repos.uploadReleaseAsset({
await github.rest.repos.uploadReleaseAsset({
owner, repo,
release_id: ${{ github.event.release.id }},
name: 'git-crypt-${{ github.event.release.name }}-linux-x86_64',
data: await fs.readFile('git-crypt'),
});

30 changes: 25 additions & 5 deletions .github/workflows/release-windows.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
on:
release:
types: [published]
pull_request:
branches:
- master
name: Build Release Binary (Windows)
jobs:
build:
Expand All @@ -10,7 +13,7 @@ jobs:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup msys2
uses: msys2/setup-msys2@v2
with:
Expand All @@ -22,17 +25,33 @@ jobs:
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-openssl
openssl-devel

- name: Build binary
shell: msys2 {0}
run: make LDFLAGS="-static-libstdc++ -static -lcrypto -lws2_32"
run: |
make clean
make ENABLE_MAN=no

- name: artifacts name
id: artifacts-name
env:
IS_RELEASE: ${{ github.event_name == 'release' }}
run: |
$artifactsName = if ($env:IS_RELEASE -eq "true") {
"git-crypt-artifacts"
} else {
"git-crypt-artifacts-dev"
}
"artifacts-name=$artifactsName" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: git-crypt-artifacts
name: ${{ env.artifacts-name }}
path: git-crypt.exe
upload:
name: Upload Release Binary
runs-on: ubuntu-latest
if: github.event_name == 'release'
needs: build
permissions:
contents: write
Expand All @@ -42,15 +61,16 @@ jobs:
with:
name: git-crypt-artifacts
- name: Upload release asset
uses: actions/github-script@v3
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require("fs").promises;
const { repo: { owner, repo }, sha } = context;
await github.repos.uploadReleaseAsset({
await github.rest.repos.uploadReleaseAsset({
owner, repo,
release_id: ${{ github.event.release.id }},
name: 'git-crypt-${{ github.event.release.name }}-x86_64.exe',
data: await fs.readFile('git-crypt.exe'),
});

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
*.o
git-crypt

.vscode/*
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@
# See COPYING file for license information.
#

# Compiler Flags
CXXFLAGS ?= -Wall -pedantic -Wno-long-long -O2
CXXFLAGS += -std=c++11
# Added -Wno-deprecated-declarations to suppress deprecated OpenSSL warnings
CXXFLAGS += -Wno-deprecated-declarations

# Installation Directories
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
MANDIR ?= $(PREFIX)/share/man

# Documentation
ENABLE_MAN ?= no
DOCBOOK_XSL ?= http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl

# Object Files
OBJFILES = \
git-crypt.o \
commands.o \
Expand All @@ -25,14 +32,31 @@ OBJFILES = \
fhstream.o

OBJFILES += crypto-openssl-10.o crypto-openssl-11.o

# Linker Flags
# Initially includes -lcrypto; additional flags will be appended based on OS
LDFLAGS += -lcrypto

# Detect Operating System
# $(OS) is typically 'Windows_NT' on Windows and empty or 'Linux' on Linux
ifeq ($(OS),Windows_NT)
# Windows-specific linker flags
LDFLAGS += -lws2_32 -lcrypt32
else
# Unix/Linux-specific linker flags
# You can add Unix-specific flags here if needed
# For example, linking against pthread:
# LDFLAGS += -lpthread
endif

# Documentation Tools
XSLTPROC ?= xsltproc
DOCBOOK_FLAGS += --param man.output.in.separate.dir 1 \
--stringparam man.output.base.dir man/ \
--param man.output.subdirs.enabled 1 \
--param man.authors.section.enabled 1

# Targets
all: build

#
Expand All @@ -46,12 +70,15 @@ build: $(BUILD_TARGETS)

build-bin: git-crypt

# Linking the binary
git-crypt: $(OBJFILES)
$(CXX) $(CXXFLAGS) -o $@ $(OBJFILES) $(LDFLAGS)

# Object File Dependencies
util.o: util.cpp util-unix.cpp util-win32.cpp
coprocess.o: coprocess.cpp coprocess-unix.cpp coprocess-win32.cpp

# Building Manual Pages
build-man: man/man1/git-crypt.1

man/man1/git-crypt.1: man/git-crypt.xml
Expand Down
9 changes: 4 additions & 5 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ Configure a repository to use git-crypt:

Specify files to encrypt by creating a .gitattributes file:

secretfile filter=git-crypt diff=git-crypt
*.key filter=git-crypt diff=git-crypt
secretdir/** filter=git-crypt diff=git-crypt
secretfile filter=git-crypt diff=git-crypt merge=git-crypt
*.key filter=git-crypt diff=git-crypt merge=git-crypt

Like a .gitignore file, it can match wildcards and should be checked into
the repository. See below for more information about .gitattributes.
Expand Down Expand Up @@ -151,10 +150,10 @@ encrypt all files beneath it.
Also note that the pattern `dir/*` does not match files under
sub-directories of dir/. To encrypt an entire sub-tree dir/, use `dir/**`:

dir/** filter=git-crypt diff=git-crypt
dir/** filter=git-crypt diff=git-crypt merge=git-crypt

The .gitattributes file must not be encrypted, so make sure wildcards don't
match it accidentally. If necessary, you can exclude .gitattributes from
encryption like this:

.gitattributes !filter !diff
.gitattributes !filter !diff !merge
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ Configure a repository to use git-crypt:

Specify files to encrypt by creating a .gitattributes file:

secretfile filter=git-crypt diff=git-crypt
*.key filter=git-crypt diff=git-crypt
secretdir/** filter=git-crypt diff=git-crypt
secretfile filter=git-crypt diff=git-crypt merge=git-crypt
*.key filter=git-crypt diff=git-crypt merge=git-crypt

Like a .gitignore file, it can match wildcards and should be checked into
the repository. See below for more information about .gitattributes.
Expand Down Expand Up @@ -153,10 +152,10 @@ encrypt all files beneath it.
Also note that the pattern `dir/*` does not match files under
sub-directories of dir/. To encrypt an entire sub-tree dir/, use `dir/**`:

dir/** filter=git-crypt diff=git-crypt
dir/** filter=git-crypt diff=git-crypt merge=git-crypt

The .gitattributes file must not be encrypted, so make sure wildcards don't
match it accidentally. If necessary, you can exclude .gitattributes from
encryption like this:

.gitattributes !filter !diff
.gitattributes !filter !diff !merge
Loading